private static void LoadNaturalnessModels <T>(HomeMadeServiceLocator sl) where T : Animal { sl.LoadDelegatedService <IFamilyCrudModel <T> >( () => new FamilyCrudModel <T>(sl.Resolve <IConversationsContainerAccessor>(), sl.Resolve <IConversationFactory>(), sl.Resolve <IDaoFactory>())); }
public IServiceLocator GetServiceLocator() { var sl = new HomeMadeServiceLocator(); var nhConfigurator = new DefaultSessionFactoryConfigurationProvider(); nhConfigurator.AfterConfigure += ((sender, e) => new SchemaExport(e.Configuration).Create(false, true)); var sfp = new SessionFactoryProvider(nhConfigurator); sl.LoadSingletonService <ISessionFactoryProvider>(sfp); sl.LoadSingletonService <IConversationFactory>(new DefaultConversationFactory(sfp, new FakeSessionWrapper())); sl.LoadSingletonService <IConversationsContainerAccessor>(new NhConversationsContainerAccessor(sfp)); sl.LoadSingletonService <IDaoFactory>(new DaoFactory(sl)); sl.LoadDelegatedService(() => sfp.GetFactory(null)); LoadNaturalnessDaos <Reptile>(sl); LoadNaturalnessDaos <Human>(sl); LoadNaturalnessModels <Reptile>(sl); LoadNaturalnessModels <Human>(sl); return(sl); }