mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
DbFirst Remark BUG
This commit is contained in:
parent
5e75c2131f
commit
1c1be00517
@ -39,10 +39,11 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
if (!this.Context.DbMaintenance.IsAnySystemTablePermissions()) {
|
if (!this.Context.DbMaintenance.IsAnySystemTablePermissions())
|
||||||
|
{
|
||||||
Check.Exception(true, "Dbfirst and Codefirst requires system table permissions");
|
Check.Exception(true, "Dbfirst and Codefirst requires system table permissions");
|
||||||
}
|
}
|
||||||
this.TableInfoList =this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetTableInfoList());
|
this.TableInfoList = this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetTableInfoList());
|
||||||
var viewList = this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetViewInfoList());
|
var viewList = this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetViewInfoList());
|
||||||
if (viewList.IsValuable())
|
if (viewList.IsValuable())
|
||||||
{
|
{
|
||||||
@ -230,17 +231,19 @@ namespace SqlSugar
|
|||||||
if (hasSugarColumn && this.IsAttribute)
|
if (hasSugarColumn && this.IsAttribute)
|
||||||
{
|
{
|
||||||
List<string> joinList = new List<string>();
|
List<string> joinList = new List<string>();
|
||||||
if (item.IsPrimarykey) {
|
if (item.IsPrimarykey)
|
||||||
|
{
|
||||||
joinList.Add("IsPrimaryKey=true");
|
joinList.Add("IsPrimaryKey=true");
|
||||||
}
|
}
|
||||||
if (item.IsIdentity)
|
if (item.IsIdentity)
|
||||||
{
|
{
|
||||||
joinList.Add("IsIdentity=true");
|
joinList.Add("IsIdentity=true");
|
||||||
}
|
}
|
||||||
if (isMappingColumn) {
|
if (isMappingColumn)
|
||||||
joinList.Add("ColumnName=\""+item.DbColumnName+"\"");
|
{
|
||||||
|
joinList.Add("ColumnName=\"" + item.DbColumnName + "\"");
|
||||||
}
|
}
|
||||||
SugarColumnText = string.Format(SugarColumnText,string.Join(",",joinList));
|
SugarColumnText = string.Format(SugarColumnText, string.Join(",", joinList));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -272,7 +275,7 @@ namespace SqlSugar
|
|||||||
private string GetPropertyTypeName(DbColumnInfo item)
|
private string GetPropertyTypeName(DbColumnInfo item)
|
||||||
{
|
{
|
||||||
string result = this.Context.Ado.DbBind.GetPropertyTypeName(item.DataType);
|
string result = this.Context.Ado.DbBind.GetPropertyTypeName(item.DataType);
|
||||||
if (result != "string"&&result!="byte[]"&&result!="object"&& item.IsNullable)
|
if (result != "string" && result != "byte[]" && result != "object" && item.IsNullable)
|
||||||
{
|
{
|
||||||
result += "?";
|
result += "?";
|
||||||
}
|
}
|
||||||
@ -287,11 +290,19 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
private string GetPropertyDescriptionText(DbColumnInfo item, string propertyDescriptionText)
|
private string GetPropertyDescriptionText(DbColumnInfo item, string propertyDescriptionText)
|
||||||
{
|
{
|
||||||
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyPropertyDescription, item.ColumnDescription);
|
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyPropertyDescription, GetColumnDescription(item.ColumnDescription));
|
||||||
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyDefaultValue, GetProertypeDefaultValue(item));
|
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyDefaultValue, GetProertypeDefaultValue(item));
|
||||||
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyIsNullable, item.IsNullable.ObjToString());
|
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyIsNullable, item.IsNullable.ObjToString());
|
||||||
return propertyDescriptionText;
|
return propertyDescriptionText;
|
||||||
}
|
}
|
||||||
|
private string GetColumnDescription(string columnDescription)
|
||||||
|
{
|
||||||
|
if (columnDescription == null) return columnDescription;
|
||||||
|
columnDescription = columnDescription.Replace("\r", "\t");
|
||||||
|
columnDescription = columnDescription.Replace("\n", "\t");
|
||||||
|
columnDescription = Regex.Replace(columnDescription, "\t{2,}", "\t");
|
||||||
|
return columnDescription;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user