文章分类 -  EntityFramework

摘要:实体控制类 public class IdentityDbContext: Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext<RegisterViewModel> { public IdentityDbContex 阅读全文
posted @ 2020-11-04 00:30 李花花小番茄
摘要:ASP.NET Core Identity 身份认证和授权系统 成员管理 默认使用 MSSQL 支持外部的 Provider 使用 ASP.NET Core Identity 登录和注册的 View AccountController Model ASP.NET Core Identity 重点类 阅读全文
posted @ 2020-10-31 21:58 李花花小番茄
摘要:appsetting.json中添加配置键值对(连接字符串)(Initial Catalog=MoviesDB为数据库名字) { "ConnectionString": { "DefaultConnection": "Data Source=DESKTOP-RPEHIEB;User ID=sa;Pa 阅读全文
posted @ 2020-10-29 23:05 李花花小番茄
摘要:执行sql语句 EFDB.Database.ExecuteSqlCommand(sql语句+(参数-如果有的话)); 查询并获取返回值: using (StudentManageDBEntities3 studentEntities = new StudentManageDBEntities3()) 阅读全文
posted @ 2020-10-22 17:23 李花花小番茄
摘要:无状态跟踪: //当只需要返回一个只读的数据的时候,并不会对数据记录进行任何的修改。 //这种时候不希望Entity Framework进行不必要的状态变动跟踪(提升性能) //使用Entity Framework的AsNoTracking方法来查询返回不带变动跟踪的查询结果。 //由于无变动跟踪, 阅读全文
posted @ 2020-10-22 15:28 李花花小番茄