Ejemplo n.º 1
0
        private static void InitializeContainer(IInitializationExpression exp)
        {
            exp.For <IDbContextManager>()
            .Use <DbContextManager>();

            exp.FillAllPropertiesOfType <IDbContextManager>()
            .Use <DbContextManager>();

            exp.For(typeof(ISimpleRepository <>))
            .Use(typeof(SimpleRepository <>));

            exp.For <IAuthentication>()
            .Use <Authentication>();

            exp.FillAllPropertiesOfType <IAuthentication>()
            .Use <Authentication>();

            exp.Scan(cfg =>
            {
                cfg.AssemblyContainingType <RepositoryBase>();
                cfg.IncludeNamespaceContainingType <RepositoryBase>();
                cfg.SingleImplementationsOfInterface();
            });

            AssemblyScanner.FindValidatorsInAssemblyContaining <RegistrationModelValidation>()
            .ForEach(result => exp.For(result.InterfaceType)
                     .Singleton()
                     .Use(result.ValidatorType));
        }
Ejemplo n.º 2
0
        private static void InitializeContainer(IInitializationExpression exp)
        {
            exp.For <IDbContextManager>()
            .Use <DbContextManager>();

            exp.FillAllPropertiesOfType <IDbContextManager>()
            .Use <DbContextManager>();

            exp.For(typeof(ISimpleRepository <>))
            .Use(typeof(SimpleRepository <>));

            exp.For <IAuthentication>()
            .Use <Authentication>();

            exp.FillAllPropertiesOfType <IAuthentication>()
            .Use <Authentication>();

            exp.Scan(cfg =>
            {
                cfg.AssemblyContainingType <RepositoryBase>();
                cfg.IncludeNamespaceContainingType <RepositoryBase>();
                cfg.SingleImplementationsOfInterface();
            });
        }