Skip to content

Instantly share code, notes, and snippets.

@flagshipxyz
Created July 9, 2016 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flagshipxyz/2b2fe7b5ceb17c4ba3e61c09f59f6a2c to your computer and use it in GitHub Desktop.
Save flagshipxyz/2b2fe7b5ceb17c4ba3e61c09f59f6a2c to your computer and use it in GitHub Desktop.
asp.net core:データベース接続先の設定
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));
//services.AddDbContext<ApplicationDbContext>(options =>
// options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddMvc();
// Add application services.
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment