随笔分类 -  entity

摘要:mainEntities2 dbcontext = new mainEntities2(); private void btnAdd_Click(object sender, RoutedEventArgs e) { Students stu = new Students(); stu.Studen 阅读全文
posted @ 2021-10-26 11:54 tofight 阅读(145) 评论(0) 推荐(0)
摘要:原文:https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider 1.Install latest Toolbox Once per Visual Studio edition (daily b 阅读全文
posted @ 2021-10-26 11:51 tofight 阅读(625) 评论(0) 推荐(0)
摘要:<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.E 阅读全文
posted @ 2021-10-26 11:44 tofight 阅读(165) 评论(0) 推荐(0)
摘要:一:数据库不存在时重新创建数据库 Database.SetInitializer<testContext>(new CreateDatabaseIfNotExists<testContext>()); 二:每次启动应用程序时创建数据库 Database.SetInitializer<testCont 阅读全文
posted @ 2021-10-22 08:54 tofight 阅读(85) 评论(0) 推荐(0)
摘要:democontext: public DemoContext(DbContextOptions<DemoContext> options):base(options) { } nuget包: <PackageReference Include="Microsoft.EntityFrameworkC 阅读全文
posted @ 2021-04-11 23:01 tofight 阅读(24) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-04-11 22:59 tofight 阅读(19) 评论(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 阅读(26) 评论(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 阅读(31) 评论(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 阅读(24) 评论(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 阅读(14) 评论(0) 推荐(0)
摘要:配置NoTracking不需要变化追踪,我注释了。 public DemoContext() { //ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } 配置日志: nuget包: <PackageRef 阅读全文
posted @ 2021-04-11 20:57 tofight 阅读(11) 评论(0) 推荐(0)
摘要:一对一模型的建立: 示例:足球队员和简历的一对一关系:每个足球队员需要对应一份简历信息 足球队员模型: using System; using System.Collections.Generic; namespace Demo.Domain { public class Player { publ 阅读全文
posted @ 2021-04-11 20:08 tofight 阅读(52) 评论(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 阅读(17) 评论(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 阅读(50) 评论(0) 推荐(0)