mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-03-07 06:30:57 +08:00
update
19
实体特性.md
19
实体特性.md
@@ -228,6 +228,25 @@ fsql.Insert(new Type()).ExecuteAffrows();
|
||||
//INSERT INTO `type`(`Name`) VALUES('xxx')
|
||||
```
|
||||
|
||||
## 自定义重写(RewriteSql)、重读(RereadSql)
|
||||
|
||||
写入时重写 SQL、读取时重写 SQL,适合 geography 类型的读写场景。
|
||||
|
||||
```csharp
|
||||
[Column(
|
||||
DbType = "geography",
|
||||
RewriteSql = "geography::STGeomFromText({0}, 4236)",
|
||||
RereadSql = "{0}.STAsText()"
|
||||
)]
|
||||
public string geo { get; set; }
|
||||
|
||||
//插入:INSERT INTO [ts_geocrud01]([id], [geo]) VALUES(@id_0, geography::STGeomFromText(@geo_0, 4236))
|
||||
|
||||
//查询:SELECT TOP 1 a.[id], a.[geo].STAsText()
|
||||
//FROM [ts_geocrud01] a
|
||||
//WHERE (a.[id] = 'c7227d5e-0bcf-4b71-8f0f-d69a552fe84e')
|
||||
```
|
||||
|
||||
## 名称
|
||||
|
||||
FreeSql 默认使用实体的类名,或属性名与数据库映射,也可以指定映射的名称;
|
||||
|
||||
1
更新日志.md
1
更新日志.md
@@ -5,6 +5,7 @@
|
||||
|
||||
> 安装前添加源:https://www.myget.org/F/ncc/api/v3/index.json
|
||||
|
||||
- 增加 Column 特性 RewriteSql/RereadSql;
|
||||
- 修复 延时属性时级联保存失败的 bug;
|
||||
- 修复 分组查询后,无法使用子查询的问题;
|
||||
- 修复 UseGenerateCommandParameterWithLambda + Enum + MapType(string) bug;
|
||||
|
||||
Reference in New Issue
Block a user