Fixed an issues with user generated PetaPoco's would not work if they included schema's.

Fixed an issue where strong typed helper methods would not generate valid SQL for column names if the poco didn't explicitly set a [Column(Name="")] attribute. The PetaPoco format allows for this though and will default to the property name.  Again this would cause issues for developers trying to use the DatabaseContext.Database class with their own Poco's.

Both the above causes would happen for example if using the PetaPoco T4 templates to automatically generate Poco's.
This commit is contained in:
Jeremy Pyne
2016-07-14 17:01:51 -04:00
parent 1dc5515e80
commit a40f87eb36
2 changed files with 16 additions and 6 deletions

View File

@@ -29,7 +29,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax
public override string GetQuotedTableName(string tableName)
{
return string.Format("[{0}]", tableName);
if (tableName.Contains(".")) {
var tableNameParts = tableName.Split(new char[] { '.' }, 2);
return string.Format("[{0}].[{1}]", tableNameParts[0], tableNameParts[1]);
} else
return string.Format("[{0}]", tableName);
}
public override string GetQuotedColumnName(string columnName)