|
RIAServices
Domain service factory for RIA Services
Autofac2 IntroductionThis module is written to allow dependency injection in DomainServices in RIA projects. Required References
Getting StartedCreate a domain service: public class MyDomainService : DomainService
{
protected readonly ISession Session;
protected MyDomainService(ISession session)
{
Session = session;
}
// Your methods
}Setup Global.asax by register your DomainServices, register the DomainServicesModule module from the contrib project and finally replace the DomainService factory with AutofacDomainServiceFactory. public class Global : HttpApplication, IContainerProviderAccessor
{
protected void Application_Start(object sender, EventArgs e)
{
var builder = new ContainerBuilder();
// Register your domain services
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).AssignableTo<DomainService>();
// Add the RIA Services module
builder.RegisterModule<DomainServicesModule>();
// Build as normal
var container = builder.Build();
_containerProvider = new ContainerProvider(container);
// Replace the DomainService.Factory with AutofacDomainServiceFactory
DomainService.Factory = new AutofacDomainServiceFactory(container);
}
static IContainerProvider _containerProvider;
public IContainerProvider ContainerProvider
{
get { return _containerProvider; }
}
}
| |
► Sign in to add a comment
I think it should be:
The WCF link seems to be down: http://code.google.com/p/autofac/wiki/WcfIntegration