当前位置: 首页>>代码示例>>C#>>正文


C# Container.RegisterAutoWired方法代码示例

本文整理汇总了C#中Funq.Container.RegisterAutoWired方法的典型用法代码示例。如果您正苦于以下问题:C# Container.RegisterAutoWired方法的具体用法?C# Container.RegisterAutoWired怎么用?C# Container.RegisterAutoWired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Funq.Container的用法示例。


在下文中一共展示了Container.RegisterAutoWired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Install

 public void Install(Container container)
 {
     container.RegisterAutoWired<DbManagementService>();
     container.RegisterAutoWired<ImageCreator>();
     container.RegisterAutoWired<OrderPersister>();
     container.RegisterAutoWired<BagOfCandyPersister>();
 }
开发者ID:cyberzed,项目名称:ServiceStack_Intro,代码行数:7,代码来源:InfrastructureInstaller.cs

示例2: Configure

        public override void Configure(Container container)
        {
            Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof(AppHost).Assembly);

            container.RegisterAutoWired<BicyleRepository>();
            container.RegisterAutoWired<BicycleValidator>();
        }
开发者ID:garora,项目名称:AngularJSForDotNet,代码行数:8,代码来源:AppHost.cs

示例3: ConfigureContainer

 private static void ConfigureContainer(Container container, string redisUrl)
 {
     container.RegisterAutoWired<DanishTransportAuthorityScraper>();
     container.RegisterAutoWired<DanishTransportAuthorityResponseParser>();
     container.Register<IVehicleInspectionLookup>(
         c => new CacheVehicleInspectionLookup(c.Resolve<ICacheClient>(), c.Resolve<DanishTransportAuthorityScraper>()));
     container.Register<IRedisClientsManager>(c => new PooledRedisClientManager(redisUrl));
     container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());
     container.Register(c => c.Resolve<IRedisClientsManager>().GetClient());
     container.RegisterAutoWired<ApiKeyFilter>();
 }
开发者ID:driis,项目名称:VehicleInspectionReports,代码行数:11,代码来源:ServiceStackAppHost.cs

示例4: ConfigureDependencies

 public static void ConfigureDependencies(Container container, IDocumentStore documentStore)
 {
     container.Register<IDocumentStore>(documentStore);
     container.RegisterAutoWired<NugetServerBridge>();
     container.RegisterAutoWired<PackageService>();
     container.RegisterAutoWired<DeployService>();
     container.RegisterAutoWired<PhysicalFileSystem>();
     container.Register<IFileSystem>(new PhysicalFileSystem());
     container.Register<ServerSettings>(c => GetServerSettings(c.Resolve<IDocumentStore>())).ReusedWithin(ReuseScope.Request);
     container.RegisterAutoWired<NugetPackageDownloader>();
 }
开发者ID:tobiaszuercher,项目名称:PowerDeploy,代码行数:11,代码来源:Bootstrapper.cs

示例5: Configure

        public override void Configure(Container container)
        {
            container.RegisterAutoWired<EmailProvider>();
            container.RegisterAutoWired<FacebookGateway>();
            container.RegisterAutoWired<TwitterGateway>();
            
            Plugins.Add(new RazorFormat());
            Plugins.Add(new RequestLogsFeature());

            var appSettings = new AppSettings();
            Plugins.Add(new AuthFeature(() => new CustomSession(), 
                new IAuthProvider[] {
                    new CredentialsAuthProvider(appSettings), 
                    new TwitterAuthProvider(appSettings),
                    new FacebookAuthProvider(appSettings), 
                }));

            container.Register<IRedisClientsManager>(new PooledRedisClientManager("localhost:6379"));
            container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());

            container.Register<IDbConnectionFactory>(
                new OrmLiteConnectionFactory("~/App_Data/db.sqlite".MapHostAbsolutePath(), 
                    SqliteDialect.Provider) {
                        ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current)
                    });

            //Store User Data into above OrmLite database
            container.Register<IAuthRepository>(c => 
                new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));

            //If using and RDBMS to persist UserAuth, we must create required tables
            var authRepo = container.Resolve<IAuthRepository>();
            authRepo.InitSchema();

            //Register MQ Service
            var mqService = new RedisMqServer(container.Resolve<IRedisClientsManager>());
            container.Register<IMessageService>(mqService);
            container.Register(mqService.MessageFactory);

            mqService.RegisterHandler<SMessage>(ServiceController.ExecuteMessage);
            mqService.RegisterHandler<CallFacebook>(ServiceController.ExecuteMessage);
            mqService.RegisterHandler<EmailMessage>(ServiceController.ExecuteMessage);
            mqService.RegisterHandler<PostStatusTwitter>(ServiceController.ExecuteMessage);

            mqService.Start();

            if (appSettings.Get("ResetAllOnStartUp", false))
            {
                ResetAll(container, (OrmLiteAuthRepository)authRepo);
            }
        }
开发者ID:NickPapageorgio,项目名称:ServiceStack.UseCases,代码行数:51,代码来源:Global.asax.cs

示例6: Configure

        public override void Configure(Container container)
        {
            ////var dbConnectionFactory = new OrmLiteConnectionFactory(HttpContext.Current.Server.MapPath("~/App_Data/db.sql"), SqliteDialect.Provider);
            ////container.Register<IDbConnectionFactory>(dbConnectionFactory);

            IAppSettings appSettings = new AppSettings();

            Plugins.Add(new SwaggerFeature());
            //Plugins.Add(new RequestLogsFeature() { RequiredRoles = null });

            container.Register(appSettings);
            container.RegisterAutoWired<IISManager>();
            container.RegisterAutoWired<AppSettingsApiKeyValidator>();
        }
开发者ID:tobiaszuercher,项目名称:PowerDeploy,代码行数:14,代码来源:AppHost.cs

示例7: Configure

        public override void Configure(Container container)
        {
            //ASP.NET MVC integration
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));

            SetConfig(CreateEndpointHostConfig());

            JsConfig.EmitCamelCaseNames = true;

            Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof(AppHost).Assembly);

            container.Register<ICacheClient>(new MemoryCacheClient());
            container.RegisterAutoWired<BicyleRepository>();

            Plugins.Add(new AuthFeature(
            () => new AuthUserSession(),
            new IAuthProvider[] {
                    new CredentialsAuthProvider()
                }));

            var userAuthRepository = new InMemoryAuthRepository();
            userAuthRepository.CreateUserAuth(new UserAuth { Email = "[email protected]", DisplayName= "Admin User"}, "admin");
            container.Register<IUserAuthRepository>(userAuthRepository);
        }
开发者ID:garora,项目名称:AngularJSForDotNet,代码行数:25,代码来源:AppHost.cs

示例8: Configure

        public override void Configure(Container container)
        {
            SetConfig(CreateEndpointHostConfig());

            JsConfig.EmitCamelCaseNames = true;

            Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof(AppHost).Assembly);

            container.RegisterAutoWired<BicyleRepository>();
        }
开发者ID:garora,项目名称:AngularJSForDotNet,代码行数:11,代码来源:AppHost.cs

示例9: Configure

 public override void Configure(Container container)
 {
     Plugins.Add(new CorsFeature());
     PreRequestFilters.Add((httpReq, httpResponse) =>
     {
         //httpReq.http
     });
     var dbConnectionFactory =
         new OrmLiteConnectionFactory(HttpContext.Current.Server.MapPath("~/App_Data/BookData.txt"),
             SqliteDialect.Provider);
     container.Register<IDbConnectionFactory>(dbConnectionFactory);
     container.RegisterAutoWired<DataRepository>();
 }
开发者ID:GeeJay1983,项目名称:BookStoreManager,代码行数:13,代码来源:Global.asax.cs

示例10: RegisterDependencies

 private static void RegisterDependencies(Container container)
 {
     //Register all your dependencies
     container.Register<ICacheClient>(new MemoryCacheClient());
     container.Register<IAuth>(new PasswordAuth());
     container.Register<IRepository>(AzureStorage.CreateSingleton(
         RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString")
         ));
     container.RegisterAutoWired<XpmsAuthProvider>().ReusedWithin(ReuseScope.Hierarchy);
     container.RegisterProcesses<AbstractProcess>();
     container.RegisterValidators(typeof(SignupRequestValidator).Assembly);
     container.RegisterDataRecords<IRepoData>(typeof(AzureStorage).Assembly);
 }
开发者ID:sufong2001,项目名称:XpmsAzure,代码行数:13,代码来源:AppHost.cs

示例11: registerDependencies

        void registerDependencies(Container container)
        {
            // ReuseScope.None disposes the Db connection.
            // Needed for Sql Server
            container.RegisterAutoWiredAs<Repository, IRepository>().ReusedWithin(ReuseScope.None);

            container.RegisterAutoWired<BaseService>().ReusedWithin(ReuseScope.None);
            container.RegisterAutoWired<HomeService>().ReusedWithin(ReuseScope.None);
            container.RegisterAutoWired<SearchService>().ReusedWithin(ReuseScope.None);
            container.RegisterAutoWiredAs<ProductsService, IProductsService>().ReusedWithin(ReuseScope.None);

            // not exposing this on PublicMvc
            //container.RegisterAutoWired<ProductsProcessorService>().ReusedWithin(ReuseScope.None);

            var connectionString = ConfigurationManager
                .ConnectionStrings["DiffStack"].ConnectionString;
            container.Register<IDbConnectionFactory>(c =>
                new OrmLiteConnectionFactory(
                    connectionString,
                    SqlServerDialect.Provider
                    )
                );
        }
开发者ID:saskim,项目名称:DiffStack,代码行数:23,代码来源:AppHostConfig.cs

示例12: Does_AutoWire_Funq_types

        public void Does_AutoWire_Funq_types()
        {
            var container = new Container();

            container.RegisterAutoWiredAs<Foo, IFoo>();

            container.RegisterAutoWired<FunqTest>();

            var test = container.Resolve<FunqTest>();
            Assert.That(test.CtorFoo, Is.Not.Null);
            Assert.That(test.CtorFoo(), Is.Not.Null);
            Assert.That(test.FunqFoo, Is.Not.Null);
            Assert.That(test.FunqFoo(), Is.Not.Null);
        }
开发者ID:HarmenGrosseDeters,项目名称:ServiceStack,代码行数:14,代码来源:IoCTests.cs

示例13: Configure

        public override void Configure(Container container)
        {
            //ASP.NET MVC integration
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));

            SetConfig(CreateEndpointHostConfig());

            JsConfig.EmitCamelCaseNames = true;

            Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof(AppHost).Assembly);

            container.RegisterAutoWired<BicyleRepository>();
        }
开发者ID:garora,项目名称:AngularJSForDotNet,代码行数:14,代码来源:AppHost.cs

示例14: ConfigureAppHost

        public void ConfigureAppHost(Container container, bool useTestDatabase = false)
        {
            JsConfig.EmitCamelCaseNames = true;

            _appHost.Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof (AppHost).Assembly);

            container.Register<ICacheClient>(new MemoryCacheClient());

            _appHost.Plugins.Add(new AuthFeature(
                () => new AuthUserSession(),
                new IAuthProvider[]
                {
                    new CredentialsAuthProvider()
                }));

            if (useTestDatabase)
            {
                container.Register<IDbConnectionFactory>(
                    new OrmLiteConnectionFactory(
                        ":memory:",
                        false,
                        SqliteDialect.Provider));
            }
            else
            {
                container.Register<IDbConnectionFactory>(
                    new OrmLiteConnectionFactory(
                        ConfigurationManager.ConnectionStrings["SqlLiteConnection"].ConnectionString.MapHostAbsolutePath(),
                        SqliteDialect.Provider));
            }

            container.RegisterAutoWired<BicyleRepository>().ReusedWithin(ReuseScope.Request);

            container.Register<IUserAuthRepository>(c =>
                new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));

            var userAuthRepository = (OrmLiteAuthRepository) container.Resolve<IUserAuthRepository>();
            userAuthRepository.CreateMissingTables();
            if (userAuthRepository.GetUserAuthByUserName("[email protected]") == null)
            {
                userAuthRepository.CreateUserAuth(
                    new UserAuth {Email = "[email protected]", DisplayName = "Admin User"}, "admin");
            }

            InitializeDatabase(container);
        }
开发者ID:garora,项目名称:AngularJSForDotNet,代码行数:47,代码来源:AppHostConfiguration.cs

示例15: Configure

        public override void Configure(Container container)
        {
            LogManager.LogFactory = new ConsoleLogFactory();

            IAppSettings appSettings = new DictionarySettings(
                new Dictionary<string, string>
                    {
                        { "backup.history", "5" },
                        { "auth.api-keys", "1337"}
                    });

            container.Register(c => appSettings);
            container.RegisterAutoWired<IISManager>();
            container.RegisterAs<AppSettingsApiKeyValidator, IApiKeyValidator>();

            Plugins.Add(new RequestLogsFeature { RequiredRoles = null });
        }
开发者ID:tobiaszuercher,项目名称:PowerDeploy,代码行数:17,代码来源:SelfAppHost.cs


注:本文中的Funq.Container.RegisterAutoWired方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。