本文整理汇总了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>();
}
示例2: Configure
public override void Configure(Container container)
{
Plugins.Add(new ValidationFeature());
container.RegisterValidators(typeof(AppHost).Assembly);
container.RegisterAutoWired<BicyleRepository>();
container.RegisterAutoWired<BicycleValidator>();
}
示例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>();
}
示例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>();
}
示例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);
}
}
示例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>();
}
示例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);
}
示例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>();
}
示例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>();
}
示例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);
}
示例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
)
);
}
示例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);
}
示例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>();
}
示例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);
}
示例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 });
}