public void Configure(IUnityAwareContext context) { var mapping = context.Container.ResolveAll <IMappingProvider>(); foreach (var o in mapping) { var type = o.GetClassMapping().Type; var typeInterface = typeof(IByExampleSpec <>).MakeGenericType(type); var typeClass = typeof(ByExampleSpec <>).MakeGenericType(type); context.Container.RegisterType(typeInterface, typeClass, new ContainerControlledLifetimeManager()); } }
public void Configure(IUnityAwareContext context) { var nhconfig = new Configuration(); nhconfig.Configure(); var fluentConfig = Fluently .Configure(nhconfig) .Mappings(m => m.FluentMappings.AddFromAssemblyOf <UnityNHSessionFactory>()); // TODO: mappings var sessionFactory = fluentConfig.BuildSessionFactory(); context.Container.RegisterInstance(typeof(ISessionFactory), sessionFactory); }