Lambda 轉換 SQL ORM 工具 SqlRepoEx
主要解決:
1、解決拼接語句,使用where以外方法時,缺少Where子句時的錯誤;
2、解決多條件拼接Where;
3、增加操作時,不再受限於例項必需有Id的自增自段
Example
IRepository<ToDo> repository = repositoryFactory.Create<ToDo>(); var results = repository.Query() .Select(e => e.Id, e => e.Task, e => e.CreatedDate); results = results.Where(e => e.IsCompleted == false); results = results.Where(e => e.Id == 3);
未改之前
更改後
指定非自增欄位
生成的SQL
指定非自增欄位
生成的SQL
原專案中的例子:
Generates the following SQL statement and maps the results back to the list of ToDo objects.
2018-9-25增加分頁操作
2018-9-25增加儲存OUTPUT引數返回
本文來自雲棲社群合作伙伴“開源中國”
本文作者:h4cd
ofollow,noindex">原文連結