Browse Source

DbFirst Description BUG

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
aed9fdd1ed
  1. 38
      SqlServerTest/Program.cs
  2. 3
      SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs
  3. 3
      SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs
  4. 2
      SqlSugar/Abstract/SqlBuilderProvider/SqlQueryBuilder.cs
  5. 3
      SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs
  6. 4
      SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

38
SqlServerTest/Program.cs

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

3
SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs

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

3
SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs

@ -40,7 +40,7 @@ namespace SqlSugar
public void Init()
{
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())
{
this.TableInfoList.AddRange(viewList);
@ -177,6 +177,7 @@ namespace SqlSugar
}
classText = classText.Replace(DbFirstTemplate.KeyConstructor, ConstructorText);
classText = classText.Replace(DbFirstTemplate.KeyPropertyName, null);
result.Remove(className);
result.Add(className, classText);
}
}

2
SqlSugar/Abstract/SqlBuilderProvider/SqlQueryBuilder.cs

@ -18,7 +18,7 @@ namespace SqlSugar
{
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())
{
this._Fields = "*";

3
SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

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

4
SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

@ -58,7 +58,7 @@ namespace SqlSugar
{
get
{
return @"SELECT s.Name,tbp.value as Description
return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
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')";
}
@ -67,7 +67,7 @@ namespace SqlSugar
{
get
{
return @"SELECT s.Name,tbp.value as Description
return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
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')";
}

Loading…
Cancel
Save