コード例 #1
0
        /// <summary>
        /// 设置数据类型的别名
        /// </summary>
        /// <typeparam name="T">数据类型</typeparam>
        /// <param name="tableName">别名</param>
        public void Set <T> (string tableName) where T : class, new()
        {
            if (string.IsNullOrEmpty(tableName))
            {
                throw new ArgumentNullException("tableName");
            }
            Type type = typeof(T);
            DataEntityMapping mapping = null;

            if (_aliaslist.ContainsKey(type))
            {
                mapping = _aliaslist [type];
            }
            else
            {
                mapping           = DataMapping.GetEntityMapping(type);
                _aliaslist [type] = mapping;
            }
            mapping.SetAliasName(tableName);
        }