mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
-
This commit is contained in:
@@ -17,21 +17,21 @@ namespace OrmTest
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
/***Unit Test***/
|
||||
new Field(1).Init();
|
||||
new Where(1).Init();
|
||||
new Method(1).Init();
|
||||
new JoinQuery(1).Init();
|
||||
new SingleQuery(1).Init();
|
||||
new SelectQuery(1).Init();
|
||||
new AutoClose(1).Init();
|
||||
new Insert(1).Init();
|
||||
new Delete(1).Init();
|
||||
new Update(1).Init();
|
||||
new Mapping(1).Init();
|
||||
///***Unit Test***/
|
||||
//new Field(1).Init();
|
||||
//new Where(1).Init();
|
||||
//new Method(1).Init();
|
||||
//new JoinQuery(1).Init();
|
||||
//new SingleQuery(1).Init();
|
||||
//new SelectQuery(1).Init();
|
||||
//new AutoClose(1).Init();
|
||||
//new Insert(1).Init();
|
||||
//new Delete(1).Init();
|
||||
//new Update(1).Init();
|
||||
//new Mapping(1).Init();
|
||||
|
||||
/***Performance Test***/
|
||||
new SqlSugarPerformance(100).Select();
|
||||
///***Performance Test***/
|
||||
//new SqlSugarPerformance(100).Select();
|
||||
|
||||
/***Demo***/
|
||||
OrmTest.Demo.Query.Init();
|
||||
|
@@ -147,9 +147,9 @@ namespace SqlSugar
|
||||
}
|
||||
classText = classText.Replace(DbFirstTemplate.KeyClassName, className);
|
||||
classText = classText.Replace(DbFirstTemplate.KeyNamespace, this.Namespace);
|
||||
classText = classText.Replace(DbFirstTemplate.KeyUsing, IsAttribute ? (this.UsingTemplate + "using " + PubConst.AssemblyName + "\r\t") : this.UsingTemplate);
|
||||
classText = classText.Replace(DbFirstTemplate.KeyUsing, IsAttribute ? (this.UsingTemplate + "using " + PubConst.AssemblyName + "\r\n") : this.UsingTemplate);
|
||||
classText = classText.Replace(DbFirstTemplate.KeyClassDescription, DbFirstTemplate.ClassDescriptionTemplate.Replace(DbFirstTemplate.KeyClassDescription, tableInfo.Description + "\r\n"));
|
||||
classText = classText.Replace(DbFirstTemplate.KeySugarTable, IsAttribute ? string.Format(DbFirstTemplate.ValueSugarTable, tableInfo.Name) : null);
|
||||
classText = classText.Replace(DbFirstTemplate.KeySugarTable, IsAttribute ? string.Format(DbFirstTemplate.ValueSugarTable, tableInfo.Name): null);
|
||||
if (columns.IsValuable())
|
||||
{
|
||||
foreach (var item in columns)
|
||||
@@ -218,16 +218,29 @@ namespace SqlSugar
|
||||
private string GetPropertyText(DbColumnInfo item, string PropertyText)
|
||||
{
|
||||
string SugarColumnText = DbFirstTemplate.ValueSugarCoulmn;
|
||||
var hasSugarColumn = item.IsPrimarykey == true || item.IsIdentity == true || item.DbColumnName.IsValuable();
|
||||
var propertyName = GetPropertyName(item);
|
||||
var isMappingColumn = propertyName != item.DbColumnName;
|
||||
var hasSugarColumn = item.IsPrimarykey == true || item.IsIdentity == true || isMappingColumn;
|
||||
if (hasSugarColumn && this.IsAttribute)
|
||||
{
|
||||
List<string> joinList = new List<string>();
|
||||
if (item.IsPrimarykey) {
|
||||
joinList.Add("IsPrimarykey=true");
|
||||
}
|
||||
if (item.IsIdentity)
|
||||
{
|
||||
joinList.Add("IsIdentity=true");
|
||||
}
|
||||
if (isMappingColumn) {
|
||||
joinList.Add("ColumnName=\""+item.DbColumnName+"\"");
|
||||
}
|
||||
SugarColumnText = string.Format(SugarColumnText,string.Join(",",joinList));
|
||||
}
|
||||
else
|
||||
{
|
||||
SugarColumnText = null;
|
||||
}
|
||||
string typeString = GetPropertyTypeName(item);
|
||||
var propertyName = GetPropertyName(item);
|
||||
PropertyText = PropertyText.Replace(DbFirstTemplate.KeySugarColumn, SugarColumnText);
|
||||
PropertyText = PropertyText.Replace(DbFirstTemplate.KeyPropertyType, typeString);
|
||||
PropertyText = PropertyText.Replace(DbFirstTemplate.KeyPropertyName, propertyName);
|
||||
|
@@ -58,8 +58,8 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Replace Value
|
||||
public const string ValueSugarTable = "[SugarTable(\"{0}\")]";
|
||||
public const string ValueSugarCoulmn = "[SugarColumn({0})]";
|
||||
public const string ValueSugarTable = "\r\n"+ClassSpace+"[SugarTable(\"{0}\")]";
|
||||
public const string ValueSugarCoulmn = "\r\n"+PropertySpace+"[SugarColumn({0})]";
|
||||
#endregion
|
||||
|
||||
#region Space
|
||||
|
Reference in New Issue
Block a user