示例#1
0
 protected string GetNullableTypeName(DbColumnInfo info)
 {
     string s = GetTypeName(info.DataType);
     if(info.AllowDBNull && info.DataType.IsValueType)
     {
         s += "?";
     }
     return s;
 }
示例#2
0
 protected virtual void BuildColumn(DbColumnInfo info)
 {
     Result.Append("\t");
     if(info.AllowDBNull && !info.DataType.IsValueType)
     {
         Result.Append("[AllowNull] ");
     }
     if(info.DataType == typeof(string) || info.DataType == typeof(byte[]))
     {
         if (info.ColumnSize < 32768)
         {
             Result.Append("[Length(").Append(info.ColumnSize).Append(")] ");
         }
     }
     if(info.IsUnique)
     {
         Result.Append("[Index(UNIQUE = true)] ");
     }
     Result.Append("public ");
     Result.Append(GetNullableTypeName(info));
     Result.Append(" ");
     Result.Append(info.ColumnName);
     Result.Append(GetColumnBody());
     Result.Append("\r\n");
 }
示例#3
0
 protected virtual void BuildKeyColomn(DbColumnInfo info)
 {
 }
示例#4
0
            protected override void ProcessColumn(DbColumnInfo info)
            {
                base.ProcessColumn(info);

                InitMethodBody.Append("\t\tthis.");
                InitMethodBody.Append(info.ColumnName);
                InitMethodBody.Append(" = ");
                InitMethodBody.Append(info.ColumnName);
                InitMethodBody.Append(";\r\n");
            }
示例#5
0
 protected override void ProcessKeyColumn(DbColumnInfo info)
 {
     if(!info.IsAutoIncrement)
     {
         ProcessColumn(info);
     }
 }
示例#6
0
 protected override void BuildKeyColomn(DbColumnInfo info)
 {
     Result.Append(info.IsAutoIncrement ? "\t[DbKey]\r\n" : "\t[DbKey(IsDbGenerate = false)]\r\n");
     BuildColumn(info);
 }
示例#7
0
 protected virtual void ProcessColumn(DbColumnInfo info)
 {
 }