コード例 #1
0
ファイル: ModelColumnsBuilder.cs プロジェクト: rexzh/RexToy
        private void BuildColumnBasic(IReflector r, IPropertyMapInfo propertyMapInfo, bool pk)
        {
            Type propType = r.GetPropertyType(propertyMapInfo.PropertyName);
            _str.Append(_tr.GetEscapedColumnName(propertyMapInfo.ColumnName)).Append(_tm.MapClrToDb(propType));

            if (propType == typeof(string) || propType == typeof(char) || propType == typeof(char?))
            {
                int length = (propertyMapInfo.Length == 0) ? DEFAULT_COL_LENGTH : propertyMapInfo.Length;
                _str.Append(length.ToString().Bracketing(StringPair.Parenthesis)).Append(SPACE);
            }

            if (!pk)
            {
                bool nullable = (propType.IsGenericType && propType.GetGenericTypeDefinition() == typeof(Nullable<>));
                _str.Append(nullable ? _tr.Null : _tr.Not + _tr.Null);
            }
        }
コード例 #2
0
ファイル: ModelColumnsBuilder.cs プロジェクト: rexzh/RexToy
        private void BuildColumnBasic(IReflector r, IPropertyMapInfo propertyMapInfo, bool pk)
        {
            Type propType = r.GetPropertyType(propertyMapInfo.PropertyName);

            _str.Append(_tr.GetEscapedColumnName(propertyMapInfo.ColumnName)).Append(_tm.MapClrToDb(propType));

            if (propType == typeof(string) || propType == typeof(char) || propType == typeof(char?))
            {
                int length = (propertyMapInfo.Length == 0) ? DEFAULT_COL_LENGTH : propertyMapInfo.Length;
                _str.Append(length.ToString().Bracketing(StringPair.Parenthesis)).Append(SPACE);
            }

            if (!pk)
            {
                bool nullable = (propType.IsGenericType && propType.GetGenericTypeDefinition() == typeof(Nullable <>));
                _str.Append(nullable ? _tr.Null : _tr.Not + _tr.Null);
            }
        }