code simplification
This commit is contained in:
@@ -6,17 +6,17 @@ namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
public ConstraintDefinition(ConstraintType type)
|
||||
{
|
||||
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; } }
|
||||
private readonly ConstraintType _constraintType;
|
||||
public bool IsPrimaryKeyConstraint => ConstraintType.PrimaryKey == _constraintType;
|
||||
public bool IsUniqueConstraint => ConstraintType.Unique == _constraintType;
|
||||
public bool IsNonUniqueConstraint => 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,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
{
|
||||
/// <summary>
|
||||
@@ -5,9 +7,17 @@ namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
/// </summary>
|
||||
internal class DbIndexDefinition
|
||||
{
|
||||
public virtual string IndexName { get; set; }
|
||||
public virtual string TableName { get; set; }
|
||||
public virtual string ColumnName { get; set; }
|
||||
public virtual bool IsUnique { get; set; }
|
||||
public DbIndexDefinition(Tuple<string, string, string, bool> data)
|
||||
{
|
||||
TableName = data.Item1;
|
||||
IndexName = data.Item2;
|
||||
ColumnName = data.Item3;
|
||||
IsUnique = data.Item4;
|
||||
}
|
||||
|
||||
public string IndexName { get; }
|
||||
public string TableName { get; }
|
||||
public string ColumnName { get; }
|
||||
public bool IsUnique { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user