- 解决 表名名称包含点,无法进行 CRUD 的问题,由于测试的复杂性,此类情况仅支持 MySql/Sqlite CodeFirst 自动迁移;

> 注意:尽量不要使用带点的表名,只有 MySql/Sqlite 对此类表名支持 CodeFirst。但是它不影响 CRUD 功能,使用 [Table(Name = "`sys.config`")] 解决
This commit is contained in:
28810
2020-01-11 02:22:16 +08:00
parent 3fe4c54ee4
commit 994cc475c2
33 changed files with 467 additions and 214 deletions

View File

@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
public class RazorModel {
public RazorModel(IFreeSql fsql, string nameSpace, bool[] NameOptions, List<DbTableInfo> tables, DbTableInfo table) {
@ -55,7 +54,12 @@ public class RazorModel {
var sb = new List<string>();
if (GetCsName(this.FullTableName) != this.FullTableName)
sb.Add("Name = \"" + this.FullTableName + "\"");
{
if (this.FullTableName.IndexOf('.') == -1)
sb.Add("Name = \"" + this.FullTableName + "\"");
else
sb.Add("Name = \"" + this.FullTableName + "\""); //Todo: QuoteSqlName
}
if (sb.Any() == false) return null;
return "[Table(" + string.Join(", ", sb) + ")]";