diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/ConstraintAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/ConstraintAttribute.cs
index f8a7ff7268..599f599f85 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/ConstraintAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/ConstraintAttribute.cs
@@ -2,15 +2,24 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents a db constraint
+ ///
[AttributeUsage(AttributeTargets.Property)]
public class ConstraintAttribute : Attribute
{
///
+ /// Gets or sets the name of the constraint
+ ///
+ ///
/// Overrides the default naming of a property constraint:
/// DF_tableName_propertyName
- ///
+ ///
public string Name { get; set; }
+ ///
+ /// Gets or sets the Default value
+ ///
public string Default { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/ForeignKeyAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/ForeignKeyAttribute.cs
index f71eb98543..a4797a9088 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/ForeignKeyAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/ForeignKeyAttribute.cs
@@ -2,6 +2,9 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents a Foreign Key reference
+ ///
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
public class ForeignKeyAttribute : ReferencesAttribute
{
@@ -9,10 +12,22 @@ namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
}
- public string OnDelete { get; set; }
- public string OnUpdate { get; set; }
+ internal string OnDelete { get; set; }
+ internal string OnUpdate { get; set; }
- public string Name { get; set; }//Used to override Default naming: FK_thisTableName_refTableName
- public string Column { get; set; }//Used to point foreign key to a specific Column. PrimaryKey column is used by default
+ ///
+ /// Gets or sets the name of the foreign key refence
+ ///
+ ///
+ /// Overrides the default naming of a foreign key reference:
+ /// FK_thisTableName_refTableName
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the name of the Column that this foreign key should reference.
+ ///
+ /// PrimaryKey column is used by default
+ public string Column { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexAttribute.cs
index 08994bdd28..9152384ffa 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexAttribute.cs
@@ -2,6 +2,9 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents an Index
+ ///
[AttributeUsage(AttributeTargets.Property)]
public class IndexAttribute : Attribute
{
@@ -10,9 +13,23 @@ namespace Umbraco.Core.Persistence.DatabaseAnnotations
IndexType = indexType;
}
- //public Type Type { get; set; }
+ ///
+ /// Gets or sets the name of the Index
+ ///
+ ///
+ /// Overrides default naming of indexes:
+ /// IX_tableName
+ ///
public string Name { get; set; }//Overrides default naming of indexes: IX_tableName
+
+ ///
+ /// Gets or sets the type of index to create
+ ///
public IndexTypes IndexType { get; private set; }
+
+ ///
+ /// Gets or sets the column name(s) for the current index
+ ///
public string ForColumns { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexTypes.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexTypes.cs
index 165c617d3a..9e6b3af8c6 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexTypes.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/IndexTypes.cs
@@ -1,5 +1,8 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Enum for the 3 types of indexes that can be created
+ ///
public enum IndexTypes
{
Clustered,
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/LengthAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/LengthAttribute.cs
index 8180fd762c..dd977aeb43 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/LengthAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/LengthAttribute.cs
@@ -2,6 +2,10 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents the length of a column
+ ///
+ /// Used to define the length of fixed sized columns - typically used for nvarchar
[AttributeUsage(AttributeTargets.Property)]
public class LengthAttribute : Attribute
{
@@ -10,6 +14,9 @@ namespace Umbraco.Core.Persistence.DatabaseAnnotations
Length = length;
}
+ ///
+ /// Gets or sets the length of a column
+ ///
public int Length { get; private set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettingAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettingAttribute.cs
index 1c4da8a2a4..af6df1613a 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettingAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettingAttribute.cs
@@ -2,9 +2,19 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents the Null-setting of a column
+ ///
+ ///
+ /// This should only be used for Columns that can be Null.
+ /// By convention the Columns will be "NOT NULL".
+ ///
[AttributeUsage(AttributeTargets.Property)]
public class NullSettingAttribute : Attribute
{
+ ///
+ /// Gets or sets the for a column
+ ///
public NullSettings NullSetting { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettings.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettings.cs
index fab2835776..3901cc9101 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettings.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/NullSettings.cs
@@ -1,5 +1,8 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Enum with the 2 possible Null settings: Null or Not Null
+ ///
public enum NullSettings
{
Null,
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/PrimaryKeyColumnAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/PrimaryKeyColumnAttribute.cs
index 784cf80af6..e71648eb2c 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/PrimaryKeyColumnAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/PrimaryKeyColumnAttribute.cs
@@ -2,6 +2,12 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents a Primary Key
+ ///
+ ///
+ /// By default, Clustered and AutoIncrement is set to true.
+ ///
[AttributeUsage(AttributeTargets.Property)]
public class PrimaryKeyColumnAttribute : Attribute
{
@@ -11,9 +17,34 @@ namespace Umbraco.Core.Persistence.DatabaseAnnotations
AutoIncrement = true;
}
- public bool Clustered { get; set; }//Defaults to true
- public bool AutoIncrement { get; set; }//Default to true
- public string Name { get; set; }//Overrides the default naming of a PrimaryKey constraint: PK_tableName
+ ///
+ /// Gets or sets a boolean indicating whether the primary key is clustered
+ ///
+ /// Defaults to true
+ public bool Clustered { get; set; }
+
+ ///
+ /// Gets or sets a boolean indicating whether the primary key is auto incremented
+ ///
+ /// Defaults to true
+ public bool AutoIncrement { get; set; }
+
+ ///
+ /// Gets or sets the name of the PrimaryKey
+ ///
+ ///
+ /// Overrides the default naming of a PrimaryKey constraint:
+ /// PK_tableName
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the names of the columns for this PrimaryKey
+ ///
+ ///
+ /// Should only be used if the PrimaryKey spans over multiple columns.
+ /// Usage: [nodeId], [otherColumn]
+ ///
public string OnColumns { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/ReferencesAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/ReferencesAttribute.cs
index b99a3f8ba1..d6c2611990 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/ReferencesAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/ReferencesAttribute.cs
@@ -2,6 +2,9 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents a reference between two tables/DTOs
+ ///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
public class ReferencesAttribute : Attribute
{
@@ -10,6 +13,9 @@ namespace Umbraco.Core.Persistence.DatabaseAnnotations
Type = type;
}
+ ///
+ /// Gets or sets the Type of the referenced DTO/table
+ ///
public Type Type { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypeAttribute.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypeAttribute.cs
index a2672773de..44333da0bc 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypeAttribute.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypeAttribute.cs
@@ -2,6 +2,12 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Attribute that represents the usage of a special type
+ ///
+ ///
+ /// Should only be used when the .NET type can't be directly translated to a DbType.
+ ///
[AttributeUsage(AttributeTargets.Property)]
public class SpecialDbTypeAttribute : Attribute
{
@@ -10,6 +16,9 @@ namespace Umbraco.Core.Persistence.DatabaseAnnotations
DatabaseType = databaseType;
}
+ ///
+ /// Gets or sets the for this column
+ ///
public SpecialDbTypes DatabaseType { get; private set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypes.cs b/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypes.cs
index 136983efb3..af3a1d8d76 100644
--- a/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypes.cs
+++ b/src/Umbraco.Core/Persistence/DatabaseAnnotations/SpecialDbTypes.cs
@@ -1,9 +1,12 @@
namespace Umbraco.Core.Persistence.DatabaseAnnotations
{
+ ///
+ /// Enum with the two special types that has to be supported because
+ /// of the current umbraco db schema.
+ ///
public enum SpecialDbTypes
{
NTEXT,
- NVARCHAR,
NCHAR
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/ISqlSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/ISqlSyntaxProvider.cs
new file mode 100644
index 0000000000..9a5cab14ec
--- /dev/null
+++ b/src/Umbraco.Core/Persistence/SqlSyntax/ISqlSyntaxProvider.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using Umbraco.Core.Persistence.DatabaseAnnotations;
+using Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions;
+
+namespace Umbraco.Core.Persistence.SqlSyntax
+{
+ ///
+ /// Defines an SqlSyntaxProvider
+ ///
+ public interface ISqlSyntaxProvider
+ {
+ string GetQuotedTableName(string tableName);
+ string GetQuotedColumnName(string columnName);
+ string GetQuotedName(string name);
+ bool DoesTableExist(Database db, string tableName);
+ string ToCreateTableStatement(TableDefinition tableDefinition);
+ List ToCreateForeignKeyStatements(TableDefinition tableDefinition);
+ List ToCreateIndexStatements(TableDefinition tableDefinition);
+ DbType GetColumnDbType(Type valueType);
+ string GetIndexType(IndexTypes indexTypes);
+ string GetColumnDefinition(ColumnDefinition column, string tableName);
+ string GetPrimaryKeyStatement(ColumnDefinition column, string tableName);
+ string ToCreatePrimaryKeyStatement(TableDefinition table);
+ string GetSpecialDbType(SpecialDbTypes dbTypes);
+ string GetConstraintDefinition(ColumnDefinition column, string tableName);
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs
index a8cd1bc0c4..2beec2bd1d 100644
--- a/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs
+++ b/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs
@@ -5,11 +5,17 @@ using Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions;
namespace Umbraco.Core.Persistence.SqlSyntax
{
+ ///
+ /// Static class that provides simple access to the MySql SqlSyntax Providers singleton
+ ///
internal static class MySqlSyntax
{
public static ISqlSyntaxProvider Provider { get { return MySqlSyntaxProvider.Instance; } }
}
+ ///
+ /// Represents an SqlSyntaxProvider for MySql
+ ///
internal class MySqlSyntaxProvider : SqlSyntaxProviderBase
{
public static MySqlSyntaxProvider Instance = new MySqlSyntaxProvider();
@@ -72,11 +78,6 @@ namespace Umbraco.Core.Persistence.SqlSyntax
sql.AppendFormat(DefaultValueFormat, column.ConstraintDefaultValue);
}
- /*sql.AppendFormat(DefaultValueFormat,
- column.ConstraintDefaultValue.Equals("getdate()")
- ? "CURRENT_TIMESTAMP"
- : column.ConstraintDefaultValue);*/
-
return sql.ToString();
}
diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs
index 551d0c0632..8a644ddd43 100644
--- a/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs
+++ b/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs
@@ -2,6 +2,17 @@
namespace Umbraco.Core.Persistence.SqlSyntax
{
+ ///
+ /// Static class that provides simple access to the Sql CE SqlSyntax Providers singleton
+ ///
+ internal static class SqlCeSyntax
+ {
+ public static ISqlSyntaxProvider Provider { get { return SqlCeSyntaxProvider.Instance; } }
+ }
+
+ ///
+ /// Represents an SqlSyntaxProvider for Sql Ce
+ ///
internal class SqlCeSyntaxProvider : SqlSyntaxProviderBase
{
public static SqlCeSyntaxProvider Instance = new SqlCeSyntaxProvider();
diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SqlServerSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SqlServerSyntaxProvider.cs
index f560d68164..ca6a5f1a13 100644
--- a/src/Umbraco.Core/Persistence/SqlSyntax/SqlServerSyntaxProvider.cs
+++ b/src/Umbraco.Core/Persistence/SqlSyntax/SqlServerSyntaxProvider.cs
@@ -1,7 +1,16 @@
-using Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions;
-
-namespace Umbraco.Core.Persistence.SqlSyntax
+namespace Umbraco.Core.Persistence.SqlSyntax
{
+ ///
+ /// Static class that provides simple access to the Sql Server SqlSyntax Providers singleton
+ ///
+ internal static class SqlServerSyntax
+ {
+ public static ISqlSyntaxProvider Provider { get { return SqlServerSyntaxProvider.Instance; } }
+ }
+
+ ///
+ /// Represents an SqlSyntaxProvider for Sql Server
+ ///
internal class SqlServerSyntaxProvider : SqlSyntaxProviderBase
{
public static SqlServerSyntaxProvider Instance = new SqlServerSyntaxProvider();
diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs
index a1c8ca9b86..b7960830f3 100644
--- a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs
+++ b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs
@@ -8,24 +8,6 @@ using Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions;
namespace Umbraco.Core.Persistence.SqlSyntax
{
- public interface ISqlSyntaxProvider
- {
- string GetQuotedTableName(string tableName);
- string GetQuotedColumnName(string columnName);
- string GetQuotedName(string name);
- bool DoesTableExist(Database db, string tableName);
- string ToCreateTableStatement(TableDefinition tableDefinition);
- List ToCreateForeignKeyStatements(TableDefinition tableDefinition);
- List ToCreateIndexStatements(TableDefinition tableDefinition);
- DbType GetColumnDbType(Type valueType);
- string GetIndexType(IndexTypes indexTypes);
- string GetColumnDefinition(ColumnDefinition column, string tableName);
- string GetPrimaryKeyStatement(ColumnDefinition column, string tableName);
- string ToCreatePrimaryKeyStatement(TableDefinition table);
- string GetSpecialDbType(SpecialDbTypes dbTypes);
- string GetConstraintDefinition(ColumnDefinition column, string tableName);
- }
-
internal abstract class SqlSyntaxProviderBase : ISqlSyntaxProvider
where TSyntax : ISqlSyntaxProvider
{
diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SyntaxConfig.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SyntaxConfig.cs
index 932939d492..eafeb46f83 100644
--- a/src/Umbraco.Core/Persistence/SqlSyntax/SyntaxConfig.cs
+++ b/src/Umbraco.Core/Persistence/SqlSyntax/SyntaxConfig.cs
@@ -2,6 +2,9 @@
namespace Umbraco.Core.Persistence.SqlSyntax
{
+ ///
+ /// Singleton to handle the configuration of an SqlSyntaxProvider
+ ///
internal static class SyntaxConfig
{
private static ISqlSyntaxProvider _sqlSyntaxProvider;
diff --git a/src/Umbraco.Core/Persistence/TransactionType.cs b/src/Umbraco.Core/Persistence/TransactionType.cs
index 0dbe754eb1..3f2fa9b87a 100644
--- a/src/Umbraco.Core/Persistence/TransactionType.cs
+++ b/src/Umbraco.Core/Persistence/TransactionType.cs
@@ -1,5 +1,8 @@
namespace Umbraco.Core.Persistence
{
+ ///
+ /// Enum for the 3 types of transactions
+ ///
internal enum TransactionType
{
Insert,
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index c0538bd050..80e5919204 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -174,6 +174,7 @@
+