摘要: democontext: public DemoContext(DbContextOptions<DemoContext> options):base(options) { } nuget包: <PackageReference Include="Microsoft.EntityFrameworkC 阅读全文
posted @ 2021-04-11 23:01 tofight 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2021-04-11 22:59 tofight 阅读(4) 评论(0) 推荐(0) 编辑
摘要: using Demo.Data; using Demo.Domain; using Microsoft.EntityFrameworkCore; using System; using System.Linq; namespace Demo.App { class Program { static 阅读全文
posted @ 2021-04-11 21:53 tofight 阅读(2) 评论(0) 推荐(0) 编辑
摘要: using Demo.Data; using Demo.Domain; using Microsoft.EntityFrameworkCore; using System; using System.Linq; namespace Demo.App { class Program { static 阅读全文
posted @ 2021-04-11 21:36 tofight 阅读(4) 评论(0) 推荐(0) 编辑
摘要: using Demo.Data; using Demo.Domain; using Microsoft.EntityFrameworkCore; using System; using System.Linq; namespace Demo.App { class Program { static 阅读全文
posted @ 2021-04-11 21:29 tofight 阅读(5) 评论(0) 推荐(0) 编辑
摘要: using Demo.Data; using Demo.Domain; using System; using System.Linq; namespace Demo.App { class Program { static void Main(string[] args) { using var 阅读全文
posted @ 2021-04-11 21:00 tofight 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 配置NoTracking不需要变化追踪,我注释了。 public DemoContext() { //ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } 配置日志: nuget包: <PackageRef 阅读全文
posted @ 2021-04-11 20:57 tofight 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 一对一模型的建立: 示例:足球队员和简历的一对一关系:每个足球队员需要对应一份简历信息 足球队员模型: using System; using System.Collections.Generic; namespace Demo.Domain { public class Player { publ 阅读全文
posted @ 2021-04-11 20:08 tofight 阅读(20) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; namespace Demo.Domain { public class Club { public 阅读全文
posted @ 2021-04-11 18:10 tofight 阅读(7) 评论(0) 推荐(0) 编辑
摘要: using Demo.Domain; using Microsoft.EntityFrameworkCore; namespace Demo.Data { class DemoContext:DbContext { protected override void OnConfiguring(DbCo 阅读全文
posted @ 2021-04-11 17:55 tofight 阅读(37) 评论(0) 推荐(0) 编辑