diff --git a/SqlServerTest/Program.cs b/SqlServerTest/Program.cs index caafd709e..86de625e8 100644 --- a/SqlServerTest/Program.cs +++ b/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(); diff --git a/SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs b/SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs index 121acdf96..4bc61dcca 100644 --- a/SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs +++ b/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[]"; diff --git a/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs b/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs index 1ba04ebf6..2b8c0cf0b 100644 --- a/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs +++ b/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); } } diff --git a/SqlSugar/Abstract/SqlBuilderProvider/SqlQueryBuilder.cs b/SqlSugar/Abstract/SqlBuilderProvider/SqlQueryBuilder.cs index 6e6e12f0b..5605defb3 100644 --- a/SqlSugar/Abstract/SqlBuilderProvider/SqlQueryBuilder.cs +++ b/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 = "*"; diff --git a/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index ab4c67507..98e7205e4 100644 --- a/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/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) diff --git a/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs b/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs index 926b33793..0caa30349 100644 --- a/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs +++ b/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')"; }