Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
e3c6919acf
  1. 1
      SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs
  2. 30
      SqlSugar/Abstract/DbFirstProvider/DbFirstTemplate.cs

1
SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs

@ -160,6 +160,7 @@ namespace SqlSugar
PropertyDescriptionText = GetPropertyDescriptionText(item, PropertyDescriptionText);
PropertyText = PropertyDescriptionText + PropertyText;
classText = classText.Replace(DbFirstTemplate.KeyPropertyName, PropertyText + (isLast?"":("\r\n" + DbFirstTemplate.KeyPropertyName)));
ConstructorText = string.Format(ConstructorText,);
}
}
classText = classText.Replace(DbFirstTemplate.KeyConstructor, ConstructorText);

30
SqlSugar/Abstract/DbFirstProvider/DbFirstTemplate.cs

@ -8,10 +8,10 @@ namespace SqlSugar
public class DbFirstTemplate
{
#region Template
public static string ClassTemplate = "{using}\r\n" +
"namespace {Namespace}\r\n" +
"{\r\n" +
"{ClassDescription}{SugarTable}\r\n" +
public static string ClassTemplate = "{using}\r\n" +
"namespace {Namespace}\r\n" +
"{\r\n" +
"{ClassDescription}{SugarTable}\r\n" +
ClassSpace+"public class {ClassName}\r\n" +
ClassSpace + "{\r\n" +
PropertySpace + "public {ClassName}(){\r\n" +
@ -37,24 +37,24 @@ namespace SqlSugar
public static string ConstructorTemplate = PropertySpace + "this.{$PropertyName} =Convert.To{PropertyType}(\"{DefaultValue}\");\r\n";
public static string UsingTemplate = "using System;\r\n" +
"using System.Linq;\r\n" +
"using System.Text;" + "\r\n";
public static string UsingTemplate = "using System;\r\n" +
"using System.Linq;\r\n" +
"using System.Text;" + "\r\n";
#endregion
#region Replace Key
public const string KeySugarTable = "{SugarTable}";
public const string KeyUsing = "{using}";
public const string KeyNamespace = "{Namespace}";
public const string KeyClassName = "{ClassName}";
public const string KeyIsNullable = "{IsNullable}";
public const string KeySugarTable = "{SugarTable}";
public const string KeyConstructor = "{Constructor}";
public const string KeyPropertyDescription = "{PropertyDescription}";
public const string KeyClassDescription = "{ClassDescription}";
public const string KeySugarColumn = "{SugarColumn}";
public const string KeyPropertyType = "{PropertyType}";
public const string KeyPropertyName = "{PropertyName}";
public const string KeyDefaultValue = "{DefaultValue}";
public const string KeyIsNullable = "{IsNullable}";
public const string KeyNamespace = "{Namespace}";
public const string KeyUsing = "{using}";
public const string KeyClassDescription = "{ClassDescription}";
public const string KeyPropertyDescription = "{PropertyDescription}";
#endregion
#region Replace Value
@ -62,7 +62,9 @@ namespace SqlSugar
public const string ValueSugarCoulmn = "[SugarColumn({0})]";
#endregion
#region Space
public const string PropertySpace = " ";
public const string ClassSpace = " ";
public const string ClassSpace = " ";
#endregion
}
}

Loading…
Cancel
Save