Symon,
Thanks for the code sample. I see how to publish a message to a
channel in a controller now. I guess the problem is primarily my lack
of knowledge about IoC. I'm trying to use Autofac (since that is what
the example AspComet uses) in my MVC3 project and I'm not sure how to
make Autofac feed the IClientRepository to my controller. I've got the
IClientRepository getter/setter in my controller and here is what my
Application_Start looks like:
private static IContainer container;
protected void Application_Start()
{
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
var builder = new ContainerBuilder();
// Let AspComet put its registrations into the container
foreach (ServiceMetadata metadata in
ServiceMetadata.GetMinimumSet())
{
if (metadata.IsPerRequest)
builder.RegisterType(metadata.ActualType).As(metadata.ServiceType);
else
builder.RegisterType(metadata.ActualType).As(metadata.ServiceType).SingleInstance();
}
builder.RegisterControllers(typeof(MvcApplication).Assembly);
//// Add our own stuff to the container
builder.RegisterType<AuthenticatedClientFactory>().As<IClientFactory>().SingleInstance();
builder.RegisterType<HandshakeAuthenticator>().SingleInstance();
builder.RegisterType<SubscriptionChecker>().SingleInstance();
container = builder.Build();
DependencyResolver.SetResolver(new
AutofacDependencyResolver(container));
}
Am I missing something? It seems like I need something to tell the IoC
to hookup the IClientRepository to the controller...
Thanks,
Austin
> Symon Rottemhttp://
blog.symbiotic-development.com