Refactoring DTOs for Identity seed, which is used by Sql Ce.

Updating unit tests and Contexts to include the ServiceContext and DatabaseContext.
This commit is contained in:
sitereactor
2012-10-30 15:03:58 -01:00
parent 347bf3fabf
commit 137a54b193
28 changed files with 226 additions and 49 deletions

View File

@@ -8,6 +8,13 @@ using Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions;
namespace Umbraco.Core.Persistence.SqlSyntax
{
/// <summary>
/// Represents the Base Sql Syntax provider implementation.
/// </summary>
/// <remarks>
/// All Sql Syntax provider implementations should derive from this abstract class.
/// </remarks>
/// <typeparam name="TSyntax"></typeparam>
internal abstract class SqlSyntaxProviderBase<TSyntax> : ISqlSyntaxProvider
where TSyntax : ISqlSyntaxProvider
{
@@ -280,6 +287,24 @@ namespace Umbraco.Core.Persistence.SqlSyntax
return indexes;
}
public virtual List<string> ToAlterIdentitySeedStatements(TableDefinition table)
{
var seeds = new List<string>();
foreach (var definition in table.ColumnDefinitions)
{
if (definition.PrimaryKeySeeding > 0)
{
seeds.Add(string.Format("ALTER TABLE {0} ALTER COLUMN {1} IDENTITY({2},1); \n",
GetQuotedTableName(table.TableName),
GetQuotedColumnName(definition.ColumnName),
definition.PrimaryKeySeeding));
}
}
return seeds;
}
public virtual bool DoesTableExist(Database db, string tableName)
{
return false;