Pages

Saturday, April 11, 2020

How to do migration from code to database in core web API

using EmployeeService.Model;
using Microsoft.EntityFrameworkCore;


namespace EmployeeService.Domain
{
    public class Connection:DbContext
    {

        public Connection(DbContextOptions opt):base(opt)
        {


        }

        public DbSet<Employee> Employee { get; set; }
    }
}

services.AddDbContext<Connection>(sp => sp.UseSqlServer("server=servername;database=database name;integrated security=true;USER ID= user;Password=password"));


https://www.entityframeworktutorial.net/efcore/entity-framework-core-migration.aspx

No comments:

Post a Comment