static ApplicationDbContext CreateManagers(out WebApiUserManager userManager, out ApplicationRoleManager roleManager) { var context = ApplicationDbContext.Create(); var userStore = new ApplicationUserStore(context, App.Id); var roleStore = new ApplicationRoleStore(context, App.Id); userManager = new WebApiUserManager(userStore); roleManager = new ApplicationRoleManager(roleStore); return(context); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(); services.AddMvc(); services.AddDbContext <NORTHWNDContext>(options => options.UseSqlServer(HelperAppSettings.ConnectionString, b => b.MigrationsAssembly("WebApi.Core"))); services.AddIdentity <User, Roles>(Options => WebApiUserManager.CreateOptions(Options)) .AddEntityFrameworkStores <NORTHWNDContext>(); RegisterIoC(services); //services.Configure<AppSettings>(Configuration); }
static WebApiUserManager CreateUserManagerOwin(IdentityFactoryOptions <WebApiUserManager> options, IOwinContext context) { return(WebApiUserManager.Create(options, context, App.Id)); }
public FakeIdentity(WebApiUserManager userManager, IUnitOfWork unitOfWork) { _userManager = userManager; _unitOfWork = unitOfWork; }
public ClientService(IUnitOfWork unitOfWork, WebApiUserManager userManager) : base(unitOfWork) { _userManager = userManager; }