本文整理汇总了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;
}