.net Core使用EF简单版:

一、Nuget导入EF库

二、写实体Model (个人喜欢DBFirst,但是Core里不能直接导入库,所以手写吧)

三、写 DBContxt

四、验证是否成功


一:SQLServer/MySQL导入的库
.net core使用EF

.net core使用EF

 

 

 

二、实体类

 1     using System;
 2     using System.Collections.Generic;
 3     using System.ComponentModel.DataAnnotations.Schema;
 4 
 5     [Table("t_errorlog")]
 6     public partial class t_errorlog
 7     {
 8         public System.Guid Id { get; set; }
 9         public Nullable<System.Guid> UserId { get; set; } 
10         public string Location { get; set; }
11         public string Content { get; set; }
12         public System.DateTime CreateTime { get; set; }
13     }
View Code

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2021-05-22
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-06-05
猜你喜欢
  • 2021-07-09
  • 2022-12-23
  • 2021-08-03
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案