摘要:
democontext: public DemoContext(DbContextOptions<DemoContext> options):base(options) { } nuget包: <PackageReference Include="Microsoft.EntityFrameworkC 阅读全文
摘要:
阅读全文
摘要:
using Demo.Data; using Demo.Domain; using Microsoft.EntityFrameworkCore; using System; using System.Linq; namespace Demo.App { class Program { static 阅读全文
摘要:
using Demo.Data; using Demo.Domain; using Microsoft.EntityFrameworkCore; using System; using System.Linq; namespace Demo.App { class Program { static 阅读全文
摘要:
using Demo.Data; using Demo.Domain; using Microsoft.EntityFrameworkCore; using System; using System.Linq; namespace Demo.App { class Program { static 阅读全文
摘要:
using Demo.Data; using Demo.Domain; using System; using System.Linq; namespace Demo.App { class Program { static void Main(string[] args) { using var 阅读全文
摘要:
配置NoTracking不需要变化追踪,我注释了。 public DemoContext() { //ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } 配置日志: nuget包: <PackageRef 阅读全文
摘要:
一对一模型的建立: 示例:足球队员和简历的一对一关系:每个足球队员需要对应一份简历信息 足球队员模型: using System; using System.Collections.Generic; namespace Demo.Domain { public class Player { publ 阅读全文
摘要:
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; namespace Demo.Domain { public class Club { public 阅读全文
摘要:
using Demo.Domain; using Microsoft.EntityFrameworkCore; namespace Demo.Data { class DemoContext:DbContext { protected override void OnConfiguring(DbCo 阅读全文