Nuget引用

LinqKit.Microsoft.EntityFrameworkCore

Microsoft.EntityFrameworkCore.SqlServer

然后新建类继承DbContext

services.AddMvc();

public class STDbContext:DbContext

  public STDbContext() {

  } 

public virtual DbSet<User> Users { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder){

optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=Test;User ID=sa,Password=; ");

base.OnConfiguring(optionsBuilder);

}

相关文章:

  • 2022-12-23
  • 2021-07-26
  • 2021-09-12
  • 2021-06-24
  • 2021-11-16
  • 2021-11-05
  • 2021-06-11
  • 2021-12-05
猜你喜欢
  • 2021-07-15
  • 2022-02-20
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
相关资源
相似解决方案