Refactoring usage of DatabaseType - more convention based.

Limiting the use of the DatabaseType, so its only used for NText and NChar.
Adding LengthAttribute for fixed sized columns.
This commit is contained in:
sitereactor
2012-10-22 12:52:29 -02:00
parent b3d8b4c53c
commit 2545de57e0
32 changed files with 83 additions and 66 deletions

View File

@@ -31,14 +31,17 @@ namespace Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions
};
//Look for specific DbType attributed a column
var databaseTypeAttribute = propertyInfo.FirstAttribute<DatabaseTypeAttribute>();
var databaseTypeAttribute = propertyInfo.FirstAttribute<SpecialDbTypeAttribute>();
if (databaseTypeAttribute != null)
{
columnDefinition.HasSpecialDbType = true;
columnDefinition.DbType = databaseTypeAttribute.DatabaseType;
}
if (databaseTypeAttribute.Length > 0)
columnDefinition.DbTypeLength = databaseTypeAttribute.Length;
var lengthAttribute = propertyInfo.FirstAttribute<LengthAttribute>();
if(lengthAttribute != null)
{
columnDefinition.DbTypeLength = lengthAttribute.Length;
}
//Look for specific Null setting attributed a column