Пример #1
0
        /// <summary>
        /// 取得数据库字段名称
        /// </summary>
        /// <param name="includeIdentityColumn">是否包含标识字段</param>
        /// <param name="includeTableName">是否包含表名</param>
        /// <returns></returns>
        public string[] GetColumnNames(bool includeIdentityColumn, bool includeTableName)
        {
            IEnumerable <KeyValuePair <string, DatabaseEntityPropertyAttribute> > temp = PropertyAttributeDict;

            if (!includeIdentityColumn)
            {
                temp = PropertyAttributeDict.Where(p => p.Value.IsPrimaryKey == false);
            }
            if (includeTableName)
            {
                return(temp.Select(p => DatabaseEntityAttribute.TableName + "." + p.Value.ColumnName).ToArray());
            }
            else
            {
                return(temp.Select(p => p.Value.ColumnName).ToArray());
            }
        }
Пример #2
0
        /// <summary>
        /// 取得实体类行版本(第一个)属性名称
        /// </summary>
        /// <returns>如果没有取到返回null</returns>
        public string GetRowVersionPropertyName()
        {
            var q = PropertyAttributeDict.FirstOrDefault(p => p.Value.IsRowVersion == true);

            return(q.Key);
        }
Пример #3
0
        /// <summary>
        /// 取得实体类标识(第一个主键)属性名称
        /// </summary>
        /// <returns>如果没有取到返回null</returns>
        public string GetIdentityPropertyName()
        {
            var q = PropertyAttributeDict.FirstOrDefault(p => p.Value.IsPrimaryKey == true);

            return(q.Key);
        }