// ======================================================================== // // Copyright (C) 2017-2018 MARC CHEVALDONNE // marc.chevaldonne.free.fr // // Module : UserDbContext.cs // Author : Marc Chevaldonné // Creation date : 2018-02-12 // // ======================================================================== using Microsoft.EntityFrameworkCore; namespace AlertWebAPI.Models { /// /// This classe deriving from DbContext allows CRUD operations on the model. /// It owns a DbSet allowing CRUD operations on type T, here Users. /// /// It uses the connection string defined in the OnConfiguring method and pointing to the database I've defined in Azure /// public class UserDbContext : DbContext { public DbSet Users { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder); optionsBuilder.UseSqlServer(@"Server=tcp:setsis.database.windows.net,1433;Initial Catalog=AlertsUsersDB;Persist Security Info=False;User ID=setsisUser;Password=setsisPassword1234;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"); } } }