本文整理汇总了C#中IMigrationContext类的典型用法代码示例。如果您正苦于以下问题:C# IMigrationContext类的具体用法?C# IMigrationContext怎么用?C# IMigrationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMigrationContext类属于命名空间,在下文中一共展示了IMigrationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SchemaIndexQuery
public SchemaIndexQuery(string schemaName, string tableName, string indexName, IMigrationContext context)
{
_schemaName = schemaName;
_tableName = tableName;
_indexName = indexName;
_context = context;
}
示例2: GetMigrationInstance
public static Migration GetMigrationInstance(
this Assembly assembly,
IMigrationContext migrationContext)
{
return (Migration) assembly.GetTypeInstance(DefaultMigrationName,
migrationContext);
}
示例3: IfDatabaseExpressionRoot
/// <summary>
/// Constricts a new instance of a <see cref="IfDatabaseExpressionRoot"/> that will only add expressions to the provided <see cref="context"/> if <see cref="databaseType"/> matches the migration processor
/// </summary>
/// <remarks>If the database type does not apply then a <seealso cref="NullIfDatabaseProcessor"/> will be used as a container to void any fluent expressions that would have been executed</remarks>
/// <param name="context">The context to add expressions to if the database type applies</param>
/// <param name="databaseType">The database type that the expressions relate to</param>
public IfDatabaseExpressionRoot(IMigrationContext context, params string[] databaseType)
{
if (databaseType == null) throw new ArgumentNullException("databaseType");
_origContext = context;
_databaseType = databaseType;
_context = DatabaseTypeApplies(context, databaseType) ? context : new MigrationContext(new MigrationConventions(), new NullIfDatabaseProcessor(), context.MigrationAssembly, context.ApplicationContext);
}
示例4: PageTypeAction
public PageTypeAction(
IPageType pageType,
IMigrationContext context)
{
this.pageType = pageType;
this.context = context;
}
示例5: ForEachFederationExpressionBuilder
public ForEachFederationExpressionBuilder(IMigrationContext context, ForEachFederationExpression expression)
{
_expression = expression;
expression.Context = new MigrationContext (context.Conventions, context.QuerySchema,
context.MigrationAssembly,
context.ApplicationContext);
}
示例6: SchemaColumnQuery
public SchemaColumnQuery(string schemaName, string tableName, string columnName, IMigrationContext context)
{
_schemaName = schemaName;
_tableName = tableName;
_columnName = columnName;
_context = context;
}
示例7: GetUpExpressions
public virtual void GetUpExpressions(IMigrationContext context)
{
lock (_mutex)
{
_context = context;
Up();
_context = null;
}
}
示例8: ToSql
public IEnumerable<string> ToSql(IProvider provider, IMigrationContext context)
{
if (_columnNames.Count == 0)
{
throw new InvalidCommandException("At least one column must be added to the AddForeignKeyTo command.");
}
string effectiveConstraintName = GetEffectiveConstraintName();
return provider.AddForeignKey(new TableName(Parent.TableName, Parent.Schema ?? context.GetDefaultSchema()), new TableName(_referencedTableName, ReferencedTableSchema ?? Parent.Schema ?? context.GetDefaultSchema()), _columnNames.Select(p => new ColumnReference(p.Key, p.Value)), effectiveConstraintName, CascadeOnDelete);
}
示例9: ToSql
public IEnumerable<string> ToSql(IProvider provider, IMigrationContext context)
{
if (_columnNames.Count == 0)
{
throw new InvalidCommandException("At least one column must be added to the AddIndex command.");
}
string effectiveIndexName = GetEffectiveIndexName();
return provider.AddIndex(new TableName(Parent.TableName, Parent.Schema ?? context.GetDefaultSchema()), _columnNames, effectiveIndexName);
}
示例10: ToSql
public IEnumerable<string> ToSql(IProvider provider, IMigrationContext context)
{
var runtimeContext = context as IRuntimeContext;
if (runtimeContext != null) // the runtimeContext == null, when recording the changes to the RecordingProvider for validation
{
Log.Verbose(LogCategory.Sql, "Performing call-back");
_action(runtimeContext);
}
yield break;
}
示例11: GetDownExpressions
public virtual void GetDownExpressions(IMigrationContext context)
{
lock (_lock)
{
ApplicationContext = context.ApplicationContext;
Database = new TransformationProvider(context);
Down();
Database = null;
}
}
示例12: GetDownExpressions
public virtual void GetDownExpressions(IMigrationContext context)
{
lock (_mutex)
{
_context = context;
ApplicationContext = context.ApplicationContext;
Down();
_context = null;
}
}
示例13: MigrateTask
/// <summary>
/// Circumvents actual SQL task migration code and records its "execution" to the test migration
/// context. It allows the actual execution of .NET code patches.
/// </summary>
/// <param name="context">the migration context</param>
/// <param name="task">the task to migrate</param>
public override void MigrateTask(IMigrationContext context, IMigrationTask task)
{
if (task is SqlScriptMigrationTask)
{
((TestMigrationContext)context).RecordExecution(task.Name);
}
else
{
base.MigrateTask(context, task);
}
}
示例14: GetUpExpressions
public virtual void GetUpExpressions(IMigrationContext context)
{
lock (_mutex)
{
_context = context;
ApplicationContext = context.ApplicationContext;
ConnectionString = context.Connection;
Up();
_context = null;
}
}
示例15: Migrate
public override void Migrate(IMigrationContext context)
{
if (!ForceFail)
{
TestMigrationContext ctx = (TestMigrationContext)context;
ctx.RecordExecution(Name);
}
else
{
throw new MigrationException("Something went wrong running '" + Name + "'");
}
}