diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 2540e36f..d1964d43 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ [assembly: AssemblyTitle("CYQ.Data 数据层(ORM)框架 V5 版本")] [assembly: AssemblyDescription("论坛:http://www.cyqdata.com/cyqdata")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("秋式软件 (2016-09-02)")] +[assembly: AssemblyCompany("秋式软件 (2016-09-06)")] [assembly: AssemblyProduct("CYQ.Data 数据层(ORM)框架 V5 版本")] [assembly: AssemblyCopyright("版权所有 (C) 秋式软件 2010-2020")] [assembly: AssemblyTrademark("CYQ.Data")] @@ -31,5 +31,5 @@ // // 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值, // 方法是按如下所示使用“*”: -[assembly: AssemblyVersion("5.6.5.1")] -[assembly: AssemblyFileVersion("5.6.5.1")] +[assembly: AssemblyVersion("5.6.5.2")] +[assembly: AssemblyFileVersion("5.6.5.2")] diff --git a/SQL/SqlCreateForSchema.cs b/SQL/SqlCreateForSchema.cs index 6eeb3543..153e1d1a 100644 --- a/SQL/SqlCreateForSchema.cs +++ b/SQL/SqlCreateForSchema.cs @@ -56,6 +56,10 @@ internal static string CreateTableDescriptionSql(string tableName, MDataColumn c } } } + if (dalType == DalType.MsSql)//ӱ + { + sb.AppendFormat("exec sp_addextendedproperty N'MS_Description', N'{0}', N'user', N'dbo', N'table', N'{1}';\r\n", columns.Description, tableName); + } result = sb.ToString().TrimEnd(';'); break; } diff --git a/Table/MDataColumn.cs b/Table/MDataColumn.cs index dd6a6587..a6464d2e 100644 --- a/Table/MDataColumn.cs +++ b/Table/MDataColumn.cs @@ -66,6 +66,26 @@ public MDataTable Table return _Table; } } + private string _Description = string.Empty; + /// + /// + /// + public string Description + { + get + { + if (string.IsNullOrEmpty(_Description) && _Table != null) + { + return _Table.Description; + } + return _Description; + } + set + { + _Description = value; + } + } + internal MDataTable _Table; public MDataColumn() : base() diff --git a/Table/MDataTable.cs b/Table/MDataTable.cs index c3491c14..5837e1f0 100644 --- a/Table/MDataTable.cs +++ b/Table/MDataTable.cs @@ -23,137 +23,7 @@ namespace CYQ.Data.Table public partial class MDataTable { #region ʽת - /* - internal void ReadFromDbDataReader(DbDataReader sdr) - { - if (sdr != null) - { - if (Columns.Count > 0 && sdr.FieldCount > 0) - { - this.Rows.Clear();//ֱӴRowмؼܹһУҪ - #region ܹSetSelectColumnsָвѯʱҪȥһЩУ - List columns = new List();//¼DataReaderС - string name = string.Empty; - - string hiddenFields = "," + AppConfig.DB.HiddenFields.ToLower() + ","; - bool isHiddenField = false; - for (int i = 0; i < sdr.FieldCount; i++) - { - name = sdr.GetName(i); - if (string.IsNullOrEmpty(name)) - { - name = "Empty_" + i; - } - name = name.Trim('"');//sqlite˫⡣ - isHiddenField = hiddenFields.IndexOf("," + name + ",", StringComparison.OrdinalIgnoreCase) > -1; - MCellStruct ms = Columns[name]; - //isContain = Columns.Contains(name); - if (isHiddenField) - { - if (ms != null) - { - Columns.Remove(name); - } - else - { - continue; - } - } - else - { - if (ms != null) - { - ms.ReaderIndex = i;//úSDRӦ - Columns.SetOrdinal(name, i); - } - else - { - MCellStruct ms2 = new MCellStruct(name, DataType.GetSqlType(sdr.GetFieldType(i))); - ms2.ReaderIndex = i; - MDataCell mdc = new MDataCell(ref ms2); - Columns.Add(ms2); - } - } - columns.Add(name.ToLower()); - } - for (int i = 0; i < Columns.Count; i++)//ƳС - { - if (!columns.Contains(Columns[i].ColumnName.ToLower())) - { - Columns.RemoveAt(i); - i--; - } - } - #endregion - - - #region - if (sdr.HasRows) - { - MDataRow mRecord = null; - object value = null; - List errIndex = new List(); - while (sdr.Read()) - { - mRecord = this.NewRow(); - object[] values=new object[sdr.FieldCount]; - for (int i = 0; i < Columns.Count; i++) - { - #region ȡ - MCellStruct ms = Columns[i]; - try - { - if (!errIndex.Contains(i)) - { - value = ms.ReaderIndex > -1 ? sdr[ms.ReaderIndex] : sdr[ms.ColumnName]; - } - else - { - value = sdr.GetString(ms.ReaderIndex > -1 ? ms.ReaderIndex : i); - } - } - catch - { - if (!errIndex.Contains(i)) - { - errIndex.Add(i); - } - try - { - value = sdr.GetString(ms.ReaderIndex > -1 ? ms.ReaderIndex : i); - } - catch { } - } - - - if (value == null || value == DBNull.Value) - { - mRecord[i].cellValue.Value = DBNull.Value; - } - else if (Convert.ToString(value) == string.Empty) - { - mRecord[i].cellValue.Value = string.Empty; - mRecord[i].cellValue.IsNull = false; - } - else - { - mRecord[i].Value = value; - } - #endregion - } - Rows.Add(mRecord); - } - errIndex = null; - } - #endregion - } - sdr.Close(); - sdr.Dispose(); - sdr = null; - } - } - */ /// /// DataReaderʽתMDataTable /// @@ -290,7 +160,25 @@ public string TableName _TableName = value; } } - + private string _Description = string.Empty; + /// + /// + /// + public string Description + { + get + { + if (string.IsNullOrEmpty(_Description)) + { + return _TableName; + } + return _Description; + } + set + { + _Description = value; + } + } private MDataColumn _Columns; /// /// ļܹ @@ -598,7 +486,7 @@ public void Merge(MDataTable newTable) { for (int i = 0; i < newTable.Rows.Count; i++) { - // _Rows.Add(newTable.Rows[i]); + // _Rows.Add(newTable.Rows[i]); NewRow(true).LoadFrom(newTable.Rows[i]); } } diff --git a/Table/MDataTableJoin.cs b/Table/MDataTableJoin.cs index c4b670ef..a5383093 100644 --- a/Table/MDataTableJoin.cs +++ b/Table/MDataTableJoin.cs @@ -178,6 +178,8 @@ internal static MDataTable Join(MDataTable dtA, MDataTable dtB, params string[] if (!isFind) { noFind.Add(v1); + joinRow = joinTable.NewRow(true);//找不到时,只加载A表。 + joinRow.LoadFrom(row);//后载加A表(同名则复盖) } } } diff --git a/Tool/DBTool.cs b/Tool/DBTool.cs index 19ed3948..c308d120 100644 --- a/Tool/DBTool.cs +++ b/Tool/DBTool.cs @@ -537,6 +537,10 @@ public static MDataColumn GetColumns(string tableName, string conn, out string e Error.Throw(errInfo); return null; } + if (!tableName.Contains(" ")) + { + tableName = GetMapTableName(conn, tableName); + } MDataColumn mdc = TableSchema.GetColumns(tableName, ref helper); helper.Dispose(); return mdc; diff --git "a/\346\233\264\346\226\260\350\256\260\345\275\225.txt" "b/\346\233\264\346\226\260\350\256\260\345\275\225.txt" index f63aac8f..3dfd30fb 100644 --- "a/\346\233\264\346\226\260\350\256\260\345\275\225.txt" +++ "b/\346\233\264\346\226\260\350\256\260\345\275\225.txt" @@ -573,4 +573,7 @@ 357ıݿ⣨NoSqlCommandselect a as b ֧֣2016-09-02) 358MActionFillʱδֵ⣨2016-09-02) 359ORMOrmBaseSimpleOrmBaseSetAopState2016-09-02) -360AutoCacheMActionFillʱĻãijɿ¡Fillָͬһ棩2016-09-02) \ No newline at end of file +360AutoCacheMActionFillʱĻãijɿ¡Fillָͬһ棩2016-09-02) +361MDataTableDescriptionԡ2016-09-03) +362DBToolGetColumnsӶԱӳ֧֣2016-09-05) +363ıݿResetTableԭûգ2016-09-06) \ No newline at end of file