EF在处理并发上并不是很好,很多时候我们需要手动写sql操作数据库。但是在基类中我们如何获取当前服务上下问操作的表呢?
使用正则是其中一种解决办法
var sql= Repository.Table.ToString(); var regex = new Regex("FROM (?<table>.*) AS"); var match = regex.Match(sql); string table = match.Groups["table"].Value;
其中sql=
SELECT "Extent1"."uuid", "Extent1"."imageid", "Extent1"."description", "Extent1"."order", "Extent1"."tags", "Extent1"."isdefault", "Extent1"."billid", "Extent1"."filename",
"Extent1"."fileext", "Extent1"."filesize", "Extent1"."storepath", "Extent1"."storename", "Extent1"."createby", "Extent1"."createon", "Extent1"."updateby", "Extent1"."updateon"
FROM "dbo"."plm_commissionerinfoimage" AS "Extent1"
原文地址:https://www.cnblogs.com/Cyril-hcj/p/11725520.html
时间: 2024-10-31 06:33:13