增加 FreeSql.Extensions.BaseEntity 项目

This commit is contained in:
28810
2019-07-29 15:35:04 +08:00
parent 8573f642d5
commit 5fc603a18b
19 changed files with 740 additions and 571 deletions

View File

@ -24,9 +24,7 @@ BaseEntity 是一种极简单的 CodeFirst 开发方式,特别对单表或多
# 声明
参考 BaseEntity.cs 源码约100行copy 到项目中使用,然后添加 nuget 引用包:
> dotnet add package FreeSql.Repository
> dotnet add package FreeSql.Extensions.BaseEntity
> dotnet add package FreeSql.Provider.Sqlite
@ -60,25 +58,6 @@ public class User : BaseEntity<UserGroup, Guid>
}
```
3、定义多主键的实体类型可以在 static 构造函数中重写字段名;
```csharp
public class User2 : BaseEntity<User2, Guid, int>
{
static User2()
{
User2.Orm.CodeFirst.ConfigEntity<User2>(t =>
{
t.Property(a => a.PkId1).Name("UserId");
t.Property(a => a.PkId2).Name("Index");
});
}
public string Username { get; set; }
}
```
# CRUD 使用
```csharp