Renormalize
This commit is contained in:
@@ -1,35 +1,35 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class ColumnDefinition
|
||||
{
|
||||
public virtual string Name { get; set; }
|
||||
//This type is typically used as part of a migration
|
||||
public virtual DbType? Type { get; set; }
|
||||
//When DbType isn't set explicitly the Type will be used to find the right DbType in the SqlSyntaxProvider.
|
||||
//This type is typically used as part of an initial table creation
|
||||
public Type PropertyType { get; set; }
|
||||
//Only used for special cases as part of an initial table creation
|
||||
public bool HasSpecialDbType { get; set; }
|
||||
public SpecialDbTypes DbType { get; set; }
|
||||
public virtual int Seeding { get; set; }
|
||||
public virtual int Size { get; set; }
|
||||
public virtual int Precision { get; set; }
|
||||
public virtual string CustomType { get; set; }
|
||||
public virtual object DefaultValue { get; set; }
|
||||
public virtual string ConstraintName { get; set; }
|
||||
public virtual bool IsForeignKey { get; set; }
|
||||
public virtual bool IsIdentity { get; set; }
|
||||
public virtual bool IsIndexed { get; set; }//Clustered?
|
||||
public virtual bool IsPrimaryKey { get; set; }
|
||||
public virtual string PrimaryKeyName { get; set; }
|
||||
public virtual string PrimaryKeyColumns { get; set; }//When the primary key spans multiple columns
|
||||
public virtual bool IsNullable { get; set; }
|
||||
public virtual bool IsUnique { get; set; }
|
||||
public virtual string TableName { get; set; }
|
||||
public virtual ModificationType ModificationType { get; set; }
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Data;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class ColumnDefinition
|
||||
{
|
||||
public virtual string Name { get; set; }
|
||||
//This type is typically used as part of a migration
|
||||
public virtual DbType? Type { get; set; }
|
||||
//When DbType isn't set explicitly the Type will be used to find the right DbType in the SqlSyntaxProvider.
|
||||
//This type is typically used as part of an initial table creation
|
||||
public Type PropertyType { get; set; }
|
||||
//Only used for special cases as part of an initial table creation
|
||||
public bool HasSpecialDbType { get; set; }
|
||||
public SpecialDbTypes DbType { get; set; }
|
||||
public virtual int Seeding { get; set; }
|
||||
public virtual int Size { get; set; }
|
||||
public virtual int Precision { get; set; }
|
||||
public virtual string CustomType { get; set; }
|
||||
public virtual object DefaultValue { get; set; }
|
||||
public virtual string ConstraintName { get; set; }
|
||||
public virtual bool IsForeignKey { get; set; }
|
||||
public virtual bool IsIdentity { get; set; }
|
||||
public virtual bool IsIndexed { get; set; }//Clustered?
|
||||
public virtual bool IsPrimaryKey { get; set; }
|
||||
public virtual string PrimaryKeyName { get; set; }
|
||||
public virtual string PrimaryKeyColumns { get; set; }//When the primary key spans multiple columns
|
||||
public virtual bool IsNullable { get; set; }
|
||||
public virtual bool IsUnique { get; set; }
|
||||
public virtual string TableName { get; set; }
|
||||
public virtual ModificationType ModificationType { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class ConstraintDefinition
|
||||
{
|
||||
public ConstraintDefinition(ConstraintType type)
|
||||
{
|
||||
constraintType = type;
|
||||
}
|
||||
|
||||
private ConstraintType constraintType;
|
||||
public bool IsPrimaryKeyConstraint { get { return ConstraintType.PrimaryKey == constraintType; } }
|
||||
public bool IsUniqueConstraint { get { return ConstraintType.Unique == constraintType; } }
|
||||
public bool IsNonUniqueConstraint { get { return ConstraintType.NonUnique == constraintType; } }
|
||||
|
||||
public string SchemaName { get; set; }
|
||||
public string ConstraintName { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public ICollection<string> Columns = new HashSet<string>();
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class ConstraintDefinition
|
||||
{
|
||||
public ConstraintDefinition(ConstraintType type)
|
||||
{
|
||||
constraintType = type;
|
||||
}
|
||||
|
||||
private ConstraintType constraintType;
|
||||
public bool IsPrimaryKeyConstraint { get { return ConstraintType.PrimaryKey == constraintType; } }
|
||||
public bool IsUniqueConstraint { get { return ConstraintType.Unique == constraintType; } }
|
||||
public bool IsNonUniqueConstraint { get { return ConstraintType.NonUnique == constraintType; } }
|
||||
|
||||
public string SchemaName { get; set; }
|
||||
public string ConstraintName { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public ICollection<string> Columns = new HashSet<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum ConstraintType
|
||||
{
|
||||
PrimaryKey,
|
||||
Unique,
|
||||
NonUnique
|
||||
}
|
||||
}
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum ConstraintType
|
||||
{
|
||||
PrimaryKey,
|
||||
Unique,
|
||||
NonUnique
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,178 +1,178 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NPoco;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
internal static class DefinitionFactory
|
||||
{
|
||||
public static TableDefinition GetTableDefinition(Type modelType, ISqlSyntaxProvider sqlSyntax)
|
||||
{
|
||||
//Looks for NPoco's TableNameAtribute for the name of the table
|
||||
//If no attribute is set we use the name of the Type as the default convention
|
||||
var tableNameAttribute = modelType.FirstAttribute<TableNameAttribute>();
|
||||
string tableName = tableNameAttribute == null ? modelType.Name : tableNameAttribute.Value;
|
||||
|
||||
var tableDefinition = new TableDefinition {Name = tableName};
|
||||
var objProperties = modelType.GetProperties().ToList();
|
||||
foreach (var propertyInfo in objProperties)
|
||||
{
|
||||
//If current property has an IgnoreAttribute then skip it
|
||||
var ignoreAttribute = propertyInfo.FirstAttribute<IgnoreAttribute>();
|
||||
if (ignoreAttribute != null) continue;
|
||||
|
||||
//If current property has a ResultColumnAttribute then skip it
|
||||
var resultColumnAttribute = propertyInfo.FirstAttribute<ResultColumnAttribute>();
|
||||
if (resultColumnAttribute != null) continue;
|
||||
|
||||
//Looks for ColumnAttribute with the name of the column, which would exist with ExplicitColumns
|
||||
//Otherwise use the name of the property itself as the default convention
|
||||
var columnAttribute = propertyInfo.FirstAttribute<ColumnAttribute>();
|
||||
string columnName = columnAttribute != null ? columnAttribute.Name : propertyInfo.Name;
|
||||
var columnDefinition = GetColumnDefinition(modelType, propertyInfo, columnName, tableName, sqlSyntax);
|
||||
tableDefinition.Columns.Add(columnDefinition);
|
||||
|
||||
//Creates a foreignkey definition and adds it to the collection on the table definition
|
||||
var foreignKeyAttributes = propertyInfo.MultipleAttribute<ForeignKeyAttribute>();
|
||||
if (foreignKeyAttributes != null)
|
||||
{
|
||||
foreach (var foreignKeyAttribute in foreignKeyAttributes)
|
||||
{
|
||||
var foreignKeyDefinition = GetForeignKeyDefinition(modelType, propertyInfo, foreignKeyAttribute, columnName, tableName);
|
||||
tableDefinition.ForeignKeys.Add(foreignKeyDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
//Creates an index definition and adds it to the collection on the table definition
|
||||
var indexAttribute = propertyInfo.FirstAttribute<IndexAttribute>();
|
||||
if (indexAttribute != null)
|
||||
{
|
||||
var indexDefinition = GetIndexDefinition(modelType, propertyInfo, indexAttribute, columnName, tableName);
|
||||
tableDefinition.Indexes.Add(indexDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
return tableDefinition;
|
||||
}
|
||||
|
||||
public static ColumnDefinition GetColumnDefinition(Type modelType, PropertyInfo propertyInfo, string columnName, string tableName, ISqlSyntaxProvider sqlSyntax)
|
||||
{
|
||||
var definition = new ColumnDefinition{ Name = columnName, TableName = tableName, ModificationType = ModificationType.Create };
|
||||
|
||||
//Look for specific Null setting attributed a column
|
||||
var nullSettingAttribute = propertyInfo.FirstAttribute<NullSettingAttribute>();
|
||||
if (nullSettingAttribute != null)
|
||||
{
|
||||
definition.IsNullable = nullSettingAttribute.NullSetting == NullSettings.Null;
|
||||
}
|
||||
|
||||
//Look for specific DbType attributed a column
|
||||
var databaseTypeAttribute = propertyInfo.FirstAttribute<SpecialDbTypeAttribute>();
|
||||
if (databaseTypeAttribute != null)
|
||||
{
|
||||
definition.HasSpecialDbType = true;
|
||||
definition.DbType = databaseTypeAttribute.DatabaseType;
|
||||
}
|
||||
else
|
||||
{
|
||||
definition.PropertyType = propertyInfo.PropertyType;
|
||||
}
|
||||
|
||||
//Look for Primary Key for the current column
|
||||
var primaryKeyColumnAttribute = propertyInfo.FirstAttribute<PrimaryKeyColumnAttribute>();
|
||||
if (primaryKeyColumnAttribute != null)
|
||||
{
|
||||
string primaryKeyName = string.IsNullOrEmpty(primaryKeyColumnAttribute.Name)
|
||||
? string.Format("PK_{0}", tableName)
|
||||
: primaryKeyColumnAttribute.Name;
|
||||
|
||||
definition.IsPrimaryKey = true;
|
||||
definition.IsIdentity = primaryKeyColumnAttribute.AutoIncrement;
|
||||
definition.IsIndexed = primaryKeyColumnAttribute.Clustered;
|
||||
definition.PrimaryKeyName = primaryKeyName;
|
||||
definition.PrimaryKeyColumns = primaryKeyColumnAttribute.OnColumns ?? string.Empty;
|
||||
definition.Seeding = primaryKeyColumnAttribute.IdentitySeed;
|
||||
}
|
||||
|
||||
//Look for Size/Length of DbType
|
||||
var lengthAttribute = propertyInfo.FirstAttribute<LengthAttribute>();
|
||||
if (lengthAttribute != null)
|
||||
{
|
||||
definition.Size = lengthAttribute.Length;
|
||||
}
|
||||
|
||||
//Look for Constraint for the current column
|
||||
var constraintAttribute = propertyInfo.FirstAttribute<ConstraintAttribute>();
|
||||
if (constraintAttribute != null)
|
||||
{
|
||||
//Special case for MySQL as it can't have multiple default DateTime values, which
|
||||
//is what the umbracoServer table definition is trying to create
|
||||
if (sqlSyntax is MySqlSyntaxProvider && definition.TableName == "umbracoServer" &&
|
||||
definition.TableName.ToLowerInvariant() == "lastNotifiedDate".ToLowerInvariant())
|
||||
return definition;
|
||||
|
||||
definition.ConstraintName = constraintAttribute.Name ?? string.Empty;
|
||||
definition.DefaultValue = constraintAttribute.Default ?? string.Empty;
|
||||
}
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
public static ForeignKeyDefinition GetForeignKeyDefinition(Type modelType, PropertyInfo propertyInfo,
|
||||
ForeignKeyAttribute attribute, string columnName, string tableName)
|
||||
{
|
||||
var referencedTable = attribute.Type.FirstAttribute<TableNameAttribute>();
|
||||
var referencedPrimaryKey = attribute.Type.FirstAttribute<PrimaryKeyAttribute>();
|
||||
|
||||
string referencedColumn = string.IsNullOrEmpty(attribute.Column)
|
||||
? referencedPrimaryKey.Value
|
||||
: attribute.Column;
|
||||
|
||||
string foreignKeyName = string.IsNullOrEmpty(attribute.Name)
|
||||
? string.Format("FK_{0}_{1}_{2}", tableName, referencedTable.Value, referencedColumn)
|
||||
: attribute.Name;
|
||||
|
||||
var definition = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
ForeignTable = tableName,
|
||||
PrimaryTable = referencedTable.Value
|
||||
};
|
||||
definition.ForeignColumns.Add(columnName);
|
||||
definition.PrimaryColumns.Add(referencedColumn);
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
public static IndexDefinition GetIndexDefinition(Type modelType, PropertyInfo propertyInfo, IndexAttribute attribute, string columnName, string tableName)
|
||||
{
|
||||
string indexName = string.IsNullOrEmpty(attribute.Name)
|
||||
? string.Format("IX_{0}_{1}", tableName, columnName)
|
||||
: attribute.Name;
|
||||
|
||||
var definition = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
IndexType = attribute.IndexType,
|
||||
ColumnName = columnName,
|
||||
TableName = tableName,
|
||||
IsClustered = attribute.IndexType == IndexTypes.Clustered,
|
||||
IsUnique = attribute.IndexType == IndexTypes.UniqueNonClustered
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(attribute.ForColumns) == false)
|
||||
{
|
||||
var columns = attribute.ForColumns.Split(',').Select(p => p.Trim());
|
||||
foreach (var column in columns)
|
||||
{
|
||||
definition.Columns.Add(new IndexColumnDefinition {Name = column, Direction = Direction.Ascending});
|
||||
}
|
||||
}
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NPoco;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
internal static class DefinitionFactory
|
||||
{
|
||||
public static TableDefinition GetTableDefinition(Type modelType, ISqlSyntaxProvider sqlSyntax)
|
||||
{
|
||||
//Looks for NPoco's TableNameAtribute for the name of the table
|
||||
//If no attribute is set we use the name of the Type as the default convention
|
||||
var tableNameAttribute = modelType.FirstAttribute<TableNameAttribute>();
|
||||
string tableName = tableNameAttribute == null ? modelType.Name : tableNameAttribute.Value;
|
||||
|
||||
var tableDefinition = new TableDefinition {Name = tableName};
|
||||
var objProperties = modelType.GetProperties().ToList();
|
||||
foreach (var propertyInfo in objProperties)
|
||||
{
|
||||
//If current property has an IgnoreAttribute then skip it
|
||||
var ignoreAttribute = propertyInfo.FirstAttribute<IgnoreAttribute>();
|
||||
if (ignoreAttribute != null) continue;
|
||||
|
||||
//If current property has a ResultColumnAttribute then skip it
|
||||
var resultColumnAttribute = propertyInfo.FirstAttribute<ResultColumnAttribute>();
|
||||
if (resultColumnAttribute != null) continue;
|
||||
|
||||
//Looks for ColumnAttribute with the name of the column, which would exist with ExplicitColumns
|
||||
//Otherwise use the name of the property itself as the default convention
|
||||
var columnAttribute = propertyInfo.FirstAttribute<ColumnAttribute>();
|
||||
string columnName = columnAttribute != null ? columnAttribute.Name : propertyInfo.Name;
|
||||
var columnDefinition = GetColumnDefinition(modelType, propertyInfo, columnName, tableName, sqlSyntax);
|
||||
tableDefinition.Columns.Add(columnDefinition);
|
||||
|
||||
//Creates a foreignkey definition and adds it to the collection on the table definition
|
||||
var foreignKeyAttributes = propertyInfo.MultipleAttribute<ForeignKeyAttribute>();
|
||||
if (foreignKeyAttributes != null)
|
||||
{
|
||||
foreach (var foreignKeyAttribute in foreignKeyAttributes)
|
||||
{
|
||||
var foreignKeyDefinition = GetForeignKeyDefinition(modelType, propertyInfo, foreignKeyAttribute, columnName, tableName);
|
||||
tableDefinition.ForeignKeys.Add(foreignKeyDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
//Creates an index definition and adds it to the collection on the table definition
|
||||
var indexAttribute = propertyInfo.FirstAttribute<IndexAttribute>();
|
||||
if (indexAttribute != null)
|
||||
{
|
||||
var indexDefinition = GetIndexDefinition(modelType, propertyInfo, indexAttribute, columnName, tableName);
|
||||
tableDefinition.Indexes.Add(indexDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
return tableDefinition;
|
||||
}
|
||||
|
||||
public static ColumnDefinition GetColumnDefinition(Type modelType, PropertyInfo propertyInfo, string columnName, string tableName, ISqlSyntaxProvider sqlSyntax)
|
||||
{
|
||||
var definition = new ColumnDefinition{ Name = columnName, TableName = tableName, ModificationType = ModificationType.Create };
|
||||
|
||||
//Look for specific Null setting attributed a column
|
||||
var nullSettingAttribute = propertyInfo.FirstAttribute<NullSettingAttribute>();
|
||||
if (nullSettingAttribute != null)
|
||||
{
|
||||
definition.IsNullable = nullSettingAttribute.NullSetting == NullSettings.Null;
|
||||
}
|
||||
|
||||
//Look for specific DbType attributed a column
|
||||
var databaseTypeAttribute = propertyInfo.FirstAttribute<SpecialDbTypeAttribute>();
|
||||
if (databaseTypeAttribute != null)
|
||||
{
|
||||
definition.HasSpecialDbType = true;
|
||||
definition.DbType = databaseTypeAttribute.DatabaseType;
|
||||
}
|
||||
else
|
||||
{
|
||||
definition.PropertyType = propertyInfo.PropertyType;
|
||||
}
|
||||
|
||||
//Look for Primary Key for the current column
|
||||
var primaryKeyColumnAttribute = propertyInfo.FirstAttribute<PrimaryKeyColumnAttribute>();
|
||||
if (primaryKeyColumnAttribute != null)
|
||||
{
|
||||
string primaryKeyName = string.IsNullOrEmpty(primaryKeyColumnAttribute.Name)
|
||||
? string.Format("PK_{0}", tableName)
|
||||
: primaryKeyColumnAttribute.Name;
|
||||
|
||||
definition.IsPrimaryKey = true;
|
||||
definition.IsIdentity = primaryKeyColumnAttribute.AutoIncrement;
|
||||
definition.IsIndexed = primaryKeyColumnAttribute.Clustered;
|
||||
definition.PrimaryKeyName = primaryKeyName;
|
||||
definition.PrimaryKeyColumns = primaryKeyColumnAttribute.OnColumns ?? string.Empty;
|
||||
definition.Seeding = primaryKeyColumnAttribute.IdentitySeed;
|
||||
}
|
||||
|
||||
//Look for Size/Length of DbType
|
||||
var lengthAttribute = propertyInfo.FirstAttribute<LengthAttribute>();
|
||||
if (lengthAttribute != null)
|
||||
{
|
||||
definition.Size = lengthAttribute.Length;
|
||||
}
|
||||
|
||||
//Look for Constraint for the current column
|
||||
var constraintAttribute = propertyInfo.FirstAttribute<ConstraintAttribute>();
|
||||
if (constraintAttribute != null)
|
||||
{
|
||||
//Special case for MySQL as it can't have multiple default DateTime values, which
|
||||
//is what the umbracoServer table definition is trying to create
|
||||
if (sqlSyntax is MySqlSyntaxProvider && definition.TableName == "umbracoServer" &&
|
||||
definition.TableName.ToLowerInvariant() == "lastNotifiedDate".ToLowerInvariant())
|
||||
return definition;
|
||||
|
||||
definition.ConstraintName = constraintAttribute.Name ?? string.Empty;
|
||||
definition.DefaultValue = constraintAttribute.Default ?? string.Empty;
|
||||
}
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
public static ForeignKeyDefinition GetForeignKeyDefinition(Type modelType, PropertyInfo propertyInfo,
|
||||
ForeignKeyAttribute attribute, string columnName, string tableName)
|
||||
{
|
||||
var referencedTable = attribute.Type.FirstAttribute<TableNameAttribute>();
|
||||
var referencedPrimaryKey = attribute.Type.FirstAttribute<PrimaryKeyAttribute>();
|
||||
|
||||
string referencedColumn = string.IsNullOrEmpty(attribute.Column)
|
||||
? referencedPrimaryKey.Value
|
||||
: attribute.Column;
|
||||
|
||||
string foreignKeyName = string.IsNullOrEmpty(attribute.Name)
|
||||
? string.Format("FK_{0}_{1}_{2}", tableName, referencedTable.Value, referencedColumn)
|
||||
: attribute.Name;
|
||||
|
||||
var definition = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
ForeignTable = tableName,
|
||||
PrimaryTable = referencedTable.Value
|
||||
};
|
||||
definition.ForeignColumns.Add(columnName);
|
||||
definition.PrimaryColumns.Add(referencedColumn);
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
public static IndexDefinition GetIndexDefinition(Type modelType, PropertyInfo propertyInfo, IndexAttribute attribute, string columnName, string tableName)
|
||||
{
|
||||
string indexName = string.IsNullOrEmpty(attribute.Name)
|
||||
? string.Format("IX_{0}_{1}", tableName, columnName)
|
||||
: attribute.Name;
|
||||
|
||||
var definition = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
IndexType = attribute.IndexType,
|
||||
ColumnName = columnName,
|
||||
TableName = tableName,
|
||||
IsClustered = attribute.IndexType == IndexTypes.Clustered,
|
||||
IsUnique = attribute.IndexType == IndexTypes.UniqueNonClustered
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(attribute.ForColumns) == false)
|
||||
{
|
||||
var columns = attribute.ForColumns.Split(',').Select(p => p.Trim());
|
||||
foreach (var column in columns)
|
||||
{
|
||||
definition.Columns.Add(new IndexColumnDefinition {Name = column, Direction = Direction.Ascending});
|
||||
}
|
||||
}
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class DeletionDataDefinition : List<KeyValuePair<string, object>>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class DeletionDataDefinition : List<KeyValuePair<string, object>>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum Direction
|
||||
{
|
||||
Ascending = 0,
|
||||
Descending = 1
|
||||
}
|
||||
}
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum Direction
|
||||
{
|
||||
Ascending = 0,
|
||||
Descending = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class ForeignKeyDefinition
|
||||
{
|
||||
public ForeignKeyDefinition()
|
||||
{
|
||||
ForeignColumns = new List<string>();
|
||||
PrimaryColumns = new List<string>();
|
||||
//Set to None by Default
|
||||
OnDelete = Rule.None;
|
||||
OnUpdate = Rule.None;
|
||||
}
|
||||
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string ForeignTable { get; set; }
|
||||
public virtual string ForeignTableSchema { get; set; }
|
||||
public virtual string PrimaryTable { get; set; }
|
||||
public virtual string PrimaryTableSchema { get; set; }
|
||||
public virtual Rule OnDelete { get; set; }
|
||||
public virtual Rule OnUpdate { get; set; }
|
||||
public virtual ICollection<string> ForeignColumns { get; set; }
|
||||
public virtual ICollection<string> PrimaryColumns { get; set; }
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class ForeignKeyDefinition
|
||||
{
|
||||
public ForeignKeyDefinition()
|
||||
{
|
||||
ForeignColumns = new List<string>();
|
||||
PrimaryColumns = new List<string>();
|
||||
//Set to None by Default
|
||||
OnDelete = Rule.None;
|
||||
OnUpdate = Rule.None;
|
||||
}
|
||||
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string ForeignTable { get; set; }
|
||||
public virtual string ForeignTableSchema { get; set; }
|
||||
public virtual string PrimaryTable { get; set; }
|
||||
public virtual string PrimaryTableSchema { get; set; }
|
||||
public virtual Rule OnDelete { get; set; }
|
||||
public virtual Rule OnUpdate { get; set; }
|
||||
public virtual ICollection<string> ForeignColumns { get; set; }
|
||||
public virtual ICollection<string> PrimaryColumns { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class IndexColumnDefinition
|
||||
{
|
||||
public virtual string Name { get; set; }
|
||||
public virtual Direction Direction { get; set; }
|
||||
}
|
||||
}
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class IndexColumnDefinition
|
||||
{
|
||||
public virtual string Name { get; set; }
|
||||
public virtual Direction Direction { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class IndexDefinition
|
||||
{
|
||||
public IndexDefinition()
|
||||
{
|
||||
Columns = new List<IndexColumnDefinition>();
|
||||
}
|
||||
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string SchemaName { get; set; }
|
||||
public virtual string TableName { get; set; }
|
||||
public virtual string ColumnName { get; set; }
|
||||
public virtual bool IsUnique { get; set; }
|
||||
public bool IsClustered { get; set; }
|
||||
public virtual ICollection<IndexColumnDefinition> Columns { get; set; }
|
||||
public IndexTypes IndexType { get; set; }
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class IndexDefinition
|
||||
{
|
||||
public IndexDefinition()
|
||||
{
|
||||
Columns = new List<IndexColumnDefinition>();
|
||||
}
|
||||
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string SchemaName { get; set; }
|
||||
public virtual string TableName { get; set; }
|
||||
public virtual string ColumnName { get; set; }
|
||||
public virtual bool IsUnique { get; set; }
|
||||
public bool IsClustered { get; set; }
|
||||
public virtual ICollection<IndexColumnDefinition> Columns { get; set; }
|
||||
public IndexTypes IndexType { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class InsertionDataDefinition : List<KeyValuePair<string, object>>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class InsertionDataDefinition : List<KeyValuePair<string, object>>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum ModificationType
|
||||
{
|
||||
Create,
|
||||
Alter,
|
||||
Drop,
|
||||
Rename,
|
||||
Insert,
|
||||
Update,
|
||||
Delete
|
||||
}
|
||||
}
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum ModificationType
|
||||
{
|
||||
Create,
|
||||
Alter,
|
||||
Drop,
|
||||
Rename,
|
||||
Insert,
|
||||
Update,
|
||||
Delete
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum SystemMethods
|
||||
{
|
||||
NewGuid,
|
||||
CurrentDateTime,
|
||||
//NewSequentialId,
|
||||
//CurrentUTCDateTime
|
||||
}
|
||||
}
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public enum SystemMethods
|
||||
{
|
||||
NewGuid,
|
||||
CurrentDateTime,
|
||||
//NewSequentialId,
|
||||
//CurrentUTCDateTime
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class TableDefinition
|
||||
{
|
||||
public TableDefinition()
|
||||
{
|
||||
Columns = new List<ColumnDefinition>();
|
||||
ForeignKeys = new List<ForeignKeyDefinition>();
|
||||
Indexes = new List<IndexDefinition>();
|
||||
}
|
||||
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string SchemaName { get; set; }
|
||||
public virtual ICollection<ColumnDefinition> Columns { get; set; }
|
||||
public virtual ICollection<ForeignKeyDefinition> ForeignKeys { get; set; }
|
||||
public virtual ICollection<IndexDefinition> Indexes { get; set; }
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public class TableDefinition
|
||||
{
|
||||
public TableDefinition()
|
||||
{
|
||||
Columns = new List<ColumnDefinition>();
|
||||
ForeignKeys = new List<ForeignKeyDefinition>();
|
||||
Indexes = new List<IndexDefinition>();
|
||||
}
|
||||
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string SchemaName { get; set; }
|
||||
public virtual ICollection<ColumnDefinition> Columns { get; set; }
|
||||
public virtual ICollection<ForeignKeyDefinition> ForeignKeys { get; set; }
|
||||
public virtual ICollection<IndexDefinition> Indexes { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user