DbFirst Description BUG

This commit is contained in:
sunkaixuan
2017-06-16 13:32:45 +08:00
parent 71a4c4e953
commit aed9fdd1ed
6 changed files with 29 additions and 24 deletions

View File

@@ -18,26 +18,26 @@ namespace OrmTest
static void Main(string[] args) static void Main(string[] args)
{ {
/***Unit Test***/ /***Unit Test***/
new Field(1).Init(); //new Field(1).Init();
new Where(1).Init(); //new Where(1).Init();
new Method(1).Init(); //new Method(1).Init();
new JoinQuery(1).Init(); //new JoinQuery(1).Init();
new SingleQuery(1).Init(); //new SingleQuery(1).Init();
new SelectQuery(1).Init(); //new SelectQuery(1).Init();
new AutoClose(1).Init(); //new AutoClose(1).Init();
new Insert(1).Init(); //new Insert(1).Init();
new Delete(1).Init(); //new Delete(1).Init();
new Update(1).Init(); //new Update(1).Init();
new Mapping(1).Init(); //new Mapping(1).Init();
new DataTest(1).Init(); //new DataTest(1).Init();
/***Performance Test***/ ///***Performance Test***/
new SqlSugarPerformance(100).Select(); //new SqlSugarPerformance(100).Select();
/***Demo***/ ///***Demo***/
OrmTest.Demo.Query.Init(); //OrmTest.Demo.Query.Init();
OrmTest.Demo.Insert.Init(); //OrmTest.Demo.Insert.Init();
OrmTest.Demo.Delete.Init(); //OrmTest.Demo.Delete.Init();
OrmTest.Demo.Update.Init(); //OrmTest.Demo.Update.Init();
OrmTest.Demo.DbFirst.Init(); OrmTest.Demo.DbFirst.Init();
OrmTest.Demo.JoinSql.Init(); OrmTest.Demo.JoinSql.Init();
OrmTest.Demo.Filter.Init(); OrmTest.Demo.Filter.Init();

View File

@@ -139,6 +139,9 @@ namespace SqlSugar
{ {
return "other"; return "other";
} }
else if (dbTypeName == "xml") {
return "string";
}
else if (propertyTypes.First().Value == CSharpDataType.byteArray) else if (propertyTypes.First().Value == CSharpDataType.byteArray)
{ {
return "byte[]"; return "byte[]";

View File

@@ -40,7 +40,7 @@ namespace SqlSugar
public void Init() public void Init()
{ {
this.TableInfoList =this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetTableInfoList()); this.TableInfoList =this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetTableInfoList());
var viewList = this.Context.DbMaintenance.GetViewInfoList(); var viewList = this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetViewInfoList());
if (viewList.IsValuable()) if (viewList.IsValuable())
{ {
this.TableInfoList.AddRange(viewList); this.TableInfoList.AddRange(viewList);
@@ -177,6 +177,7 @@ namespace SqlSugar
} }
classText = classText.Replace(DbFirstTemplate.KeyConstructor, ConstructorText); classText = classText.Replace(DbFirstTemplate.KeyConstructor, ConstructorText);
classText = classText.Replace(DbFirstTemplate.KeyPropertyName, null); classText = classText.Replace(DbFirstTemplate.KeyPropertyName, null);
result.Remove(className);
result.Add(className, classText); result.Add(className, classText);
} }
} }

View File

@@ -18,7 +18,7 @@ namespace SqlSugar
{ {
if (this._Fields.IsNullOrEmpty()) if (this._Fields.IsNullOrEmpty())
{ {
this._Fields = Regex.Match(this.sql.ToString(), @"select(.*?)from", RegexOptions.IgnoreCase).Groups[1].Value; this._Fields = Regex.Match(this.sql.ObjToString().Replace("\n",string.Empty).Replace("\r", string.Empty).Trim(), @"select(.*?)from", RegexOptions.IgnoreCase).Groups[1].Value;
if (this._Fields.IsNullOrEmpty()) if (this._Fields.IsNullOrEmpty())
{ {
this._Fields = "*"; this._Fields = "*";

View File

@@ -253,7 +253,8 @@ namespace SqlSugar
{ "Equals","Equals"}, { "Equals","Equals"},
{ "ToLower","ToLower"}, { "ToLower","ToLower"},
{ "ToUpper","ToUpper"}, { "ToUpper","ToUpper"},
{ "Substring","Substring"} { "Substring","Substring"},
{ "Trim","Trim"}
}; };
private void CheckMethod(MethodCallExpression expression) private void CheckMethod(MethodCallExpression expression)

View File

@@ -58,7 +58,7 @@ namespace SqlSugar
{ {
get get
{ {
return @"SELECT s.Name,tbp.value as Description return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
FROM sysobjects s FROM sysobjects s
LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 WHERE s.xtype IN('U')"; LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 WHERE s.xtype IN('U')";
} }
@@ -67,7 +67,7 @@ namespace SqlSugar
{ {
get get
{ {
return @"SELECT s.Name,tbp.value as Description return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
FROM sysobjects s FROM sysobjects s
LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 WHERE s.xtype IN('V')"; LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 WHERE s.xtype IN('V')";
} }