本文整理匯總了C#中SimpleInjector.Container.GetOwinContext方法的典型用法代碼示例。如果您正苦於以下問題:C# Container.GetOwinContext方法的具體用法?C# Container.GetOwinContext怎麽用?C# Container.GetOwinContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SimpleInjector.Container
的用法示例。
在下文中一共展示了Container.GetOwinContext方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetInitializeContainer
public static Container GetInitializeContainer(
IAppBuilder app)
{
var container = new Container();
container.RegisterSingleton(app);
container.RegisterConditional(typeof(IRepository<>), typeof(Repository<>), c => !c.Handled);
container.RegisterPerWebRequest<IDragonUserStore<AppMember>>(() =>
new Dragon.SecurityServer.ChainedIdentity.Stores.UserStore<AppMember>(new List<IDragonUserStore<AppMember>>{
new UserStore<AppMember>(new Repository<AppMember>(), new Repository<IdentityUserClaim>(), new Repository<IdentityUserLogin>(), null, null)
}));
container.RegisterPerWebRequest(() => ApplicationUserManager.Create(container));
container.RegisterPerWebRequest(() => container.GetOwinContext().Authentication);
container.RegisterMvcControllers(
Assembly.GetExecutingAssembly());
return container;
}
示例2: GetInitializeContainer
public static Container GetInitializeContainer(
IAppBuilder app)
{
var container = new Container();
container.Options.PropertySelectionBehavior = new ImportPropertySelectionBehavior(); // Enable ImportAttribute for property injection
container.RegisterSingleton(app);
container.Register<IFederationService, FederationService>(Lifestyle.Singleton);
container.Register<IAppService, AppService>(Lifestyle.Transient);
container.RegisterConditional(typeof(IRepository<>), typeof(Repository<>), c => !c.Handled);
container.Register<ICheckPasswordService<AppMember>, LegacyCheckPasswordService<AppMember>>(Lifestyle.Transient);
container.RegisterPerWebRequest<IDragonUserStore<AppMember>>(() =>
{
var dragonUserStores = new List<IDragonUserStore<AppMember>>
{
new UserStore<AppMember>(new Repository<AppMember>(), null, new Repository<IdentityUserLogin>(),
new Repository<IdentityUserService>(), new Repository<IdentityUserApp>())
};
if (WebConfigurationManager.ConnectionStrings[RedisConnectionStringName] != null)
{
var connectionMultiplexer = ConnectionMultiplexer.Connect(WebConfigurationManager.ConnectionStrings[RedisConnectionStringName].ConnectionString);
connectionMultiplexer.PreserveAsyncOrder = false;
dragonUserStores.Insert(0, new Identity.Redis.UserStore<AppMember>(new RedisUserStore<Identity.Redis.IdentityUser>(connectionMultiplexer), connectionMultiplexer));
}
var userStore = new ChainedIdentity.Stores.UserStore<AppMember>(dragonUserStores);
Startup.OpenIdMigrationWebrequestHandler = new OpenIdMigrationWebRequestHandler(userStore);
return userStore;
});
container.Register<IUserService, UserService>(Lifestyle.Transient);
container.RegisterPerWebRequest(() => ApplicationUserManager.Create(container, Startup.DataProtectionProvider));
container.RegisterPerWebRequest(() => container.GetOwinContext().Authentication);
container.RegisterMvcControllers(
Assembly.GetExecutingAssembly());
return container;
}