按照EFCore常規(guī)使用方法,申明表的Entity及Dbcontext后,在program.cs文件中添加 1 2 3 builder.Services.AddDbContext<Service.DataContext>(opt => { opt.UseSqlServer(builder.Configuration.GetConnectionString("Default")); }); 即可在其他地方注入使用 DataContext 使用Sqlite數(shù)據(jù)庫(kù),需要引用 Microsoft.EntityFramewor...
www.dbjr.com.cn/article/2324...htm 2025-6-7