• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMigration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMigration的典型用法代码示例。如果您正苦于以下问题:C# IMigration类的具体用法?C# IMigration怎么用?C# IMigration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMigration类属于命名空间,在下文中一共展示了IMigration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: printAllMigrations

 static void printAllMigrations(IMigration[] migrations) {
     foreach (var m in migrations) {
         Console.WriteLine("========================================");
         Console.WriteLine(m.version + "\n  - " + m.description + "\n  - Use on folder, " + m.workingDirectory);
     }
     Console.WriteLine("========================================");
 }
开发者ID:ariessanchezsulit,项目名称:Entitas-CSharp,代码行数:7,代码来源:Program.cs


示例2: MigrationWithMetaDataAdapter

 public MigrationWithMetaDataAdapter(IMigration migration, IMigrationMetadata metadata)
 {
     if (migration == null) throw new ArgumentNullException("migration");
     if (metadata == null) throw new ArgumentNullException("metadata");
     Migration = migration;
     MetaData = metadata;
 }
开发者ID:rebootd,项目名称:fluentmigrator,代码行数:7,代码来源:MigrationWithMetaDataAdapter.cs


示例3: migrate

        static void migrate(IMigration migration)
        {
            var shouldMigrate = EditorUtility.DisplayDialog("Migrate",
                                    "You are about to migrate your source files. " +
                                    "Make sure that you have committed your current project or that you have a backup of your project before you proceed.",
                                    "I have a backup - Migrate",
                                    "Cancel"
                                );

            if(shouldMigrate) {
                EditorUtility.DisplayDialog("Migrate",
                    "Please select the folder, " + migration.workingDirectory + ".",
                    "I will select the requested folder"
                );

                var path = "Assets/";
                path = EditorUtility.OpenFolderPanel(migration.version + ": " + migration.workingDirectory, path, string.Empty);
                if(!string.IsNullOrEmpty(path)) {
                    var changedFiles = migration.Migrate(path);
                    Debug.Log("Applying " + migration.version);
                    foreach(var file in changedFiles) {
                        MigrationUtils.WriteFiles(changedFiles);
                        Debug.Log("Migrated " + file.fileName);
                    }
                } else {
                    throw new Exception("Could not complete migration! Selected path was invalid!");
                }
            }
        }
开发者ID:sschmid,项目名称:Entitas-CSharp,代码行数:29,代码来源:EntitasMigrationWindow.cs


示例4: printUsage

 static void printUsage(IMigration[] migrations)
 {
     Console.WriteLine(@"usage:
     [-l]             - print all available versions
     [version] [path] - apply migration of version [version] to source files located at [path]"
     );
 }
开发者ID:JuDelCo,项目名称:Entitas-CSharp,代码行数:7,代码来源:Program.cs


示例5: Main

        public static void Main(string[] args)
        {
            var allMigrations = new IMigration[] {
                new M0180(),
                new M0190(),
                new M0220(),
                new M0260(),
                new M0300()
            };

            if (args == null) {
                printUsage(allMigrations);
            } else if (args.Length == 1) {
                var arg = args[0];
                if (arg == "-l") {
                    printAllMigrations(allMigrations);
                } else {
                    printUsage(allMigrations);
                }
            } else if (args.Length == 2) {
                var version = args[0];
                var path = args[1];
                var migrations = allMigrations.Where(m => m.version == version).ToArray();
                if (migrations.Length == 0) {
                    printVersionNotFound(version, allMigrations);
                } else {
                    foreach (var m in migrations) {
                        MigrationUtils.WriteFiles(m.Migrate(path));
                    }
                }
            } else {
                printUsage(allMigrations);
            }
        }
开发者ID:JuDelCo,项目名称:Entitas-CSharp,代码行数:34,代码来源:Program.cs


示例6: AfterMigrationEventArgs

 /// <summary>
 /// Initializes a new instance of the <see cref="AfterMigrationEventArgs"/> class.
 /// </summary>
 /// <param name="version">The version.</param>
 /// <param name="migration">The migration.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="success">if set to <c>true</c> the migration succeeded.</param>
 public AfterMigrationEventArgs(long version, IMigration migration, MigrationDirection direction, bool success)
 {
     Version = version;
     Migration = migration;
     Direction = direction;
     Success = success;
 }
开发者ID:roufamatic,项目名称:NMigrations,代码行数:14,代码来源:AfterMigrationEventArgs.cs


示例7: ExtractTimestamp

 private long ExtractTimestamp(string moduleName, IMigration migration)
 {
     var timestampProvider = _timestampProviders.ContainsKey(moduleName)
         ? _timestampProviders[moduleName]
         : _timestampProviders[MigrationExportAttribute.DefaultModuleName];
     long timestamp = timestampProvider.GetTimestamp(migration.GetType());
     return timestamp;
 }
开发者ID:dradovic,项目名称:MigSharp,代码行数:8,代码来源:MigrationImporter.cs


示例8: MigrationStep

 public MigrationStep(IMigration migration, IScheduledMigrationMetadata metadata, ConnectionInfo connectionInfo, IProvider provider, IProviderMetadata providerMetadata, IDbConnectionFactory connectionFactory, ISqlDispatcher sqlDispatcher)
     : base(migration, provider, providerMetadata)
 {
     _metadata = metadata;
     _connectionInfo = connectionInfo;
     _connectionFactory = connectionFactory;
     _sqlDispatcher = sqlDispatcher;
 }
开发者ID:mediocreguy,项目名称:MigSharp,代码行数:8,代码来源:MigrationStep.cs


示例9: MigrationInfo

        public MigrationInfo(long version, TransactionBehavior transactionBehavior, IMigration migration)
        {
            if (migration == null) throw new ArgumentNullException("migration");

            Version = version;
            TransactionBehavior = transactionBehavior;
            Migration = migration;
        }
开发者ID:abusby,项目名称:fluentmigrator,代码行数:8,代码来源:MigrationInfo.cs


示例10: MigrationInfo

        public MigrationInfo(long version, TransactionBehavior transactionBehavior, bool breakingChange, IMigration migration)
        {
            if (migration == null) throw new ArgumentNullException("migration");

            Version = version;
            TransactionBehavior = transactionBehavior;
            Migration = migration;
            BreakingChange = breakingChange;
        }
开发者ID:AlexCuse,项目名称:fluentmigrator,代码行数:9,代码来源:IMigrationInfo.cs


示例11: ApplyMigration

		private void ApplyMigration(IMigration migration, MigrationAttribute attr) {
			// we're adding this one
			_logger.MigrateUp(Current, migration.Name);
			if (! DryRun) {
				migration.Up();
				_provider.MigrationApplied(attr.Version);
				_provider.Commit();
				migration.AfterUp();
			}
		}
开发者ID:chrisortman,项目名称:Ketchup.EntityFramework,代码行数:10,代码来源:MigrateAnywhere.cs


示例12: MigrationVersionRunner

 public MigrationVersionRunner(IMigrationConventions conventions, IMigrationProcessor processor, IMigrationLoader loader, Assembly assembly, string @namespace)
 {
     _migrationConventions = conventions;
     _migrationProcessor = processor;
     _migrationAssembly = assembly;
     _migrationLoader = loader;
     _namespace = @namespace;
     _migrationRunner = new MigrationRunner(conventions, processor);
        _versionMigration = new VersionMigration();
 }
开发者ID:developingchris,项目名称:fluentmigrator,代码行数:10,代码来源:MigrationVersionRunner.cs


示例13: RemoveMigration

		private void RemoveMigration(IMigration migration, MigrationAttribute attr) {
			// we're removing this one
			_logger.MigrateDown(Current, migration.Name);
			if (! DryRun) {
				migration.Down();
				_provider.MigrationUnApplied(attr.Version);
				_provider.Commit();
				migration.AfterDown();
			}
		}
开发者ID:chrisortman,项目名称:Ketchup.EntityFramework,代码行数:10,代码来源:MigrateAnywhere.cs


示例14: Migrate

 public override void Migrate(IMigration migration)
 {
     _provider.BeginTransaction();
     MigrationAttribute attr = (MigrationAttribute)Attribute.GetCustomAttribute(migration.GetType(), typeof(MigrationAttribute));
     
     if (_provider.AppliedMigrations.Contains(attr.Version)) {
     	RemoveMigration(migration, attr);
     } else {
     	ApplyMigration(migration, attr);
     }
 }
开发者ID:X0nic,项目名称:Migrator.NET,代码行数:11,代码来源:MigrateAnywhere.cs


示例15: SolveDependency

 private void SolveDependency(IDbRoot root, string filePath, IMigration migration)
 {
     foreach (var migrationId in migration.MigrationsNeeded.Where(x => !root.MigrationHistory.HasMigration(x)))
     {
         // For each dependency that needs to be solved, we solve the subdependencies
         var dependency = this.migrations[migrationId];
         this.SolveDependency(root, filePath, dependency);
         dependency.Apply(root, filePath);
         root.MigrationHistory.AddMigration(migrationId);
     }
 }
开发者ID:calvcoll,项目名称:0x2eNEET,代码行数:11,代码来源:MigrationExecuter.cs


示例16: Migrate

 private Task Migrate(IMigration migration, Func<IMigration, Task> action)
 {
     try
     {
         return action(migration);
     }
     finally
     {
         var disposable = migration as IDisposable;
         disposable?.Dispose();
     }
 }
开发者ID:tim-cools,项目名称:RealTimeWeb.NET,代码行数:12,代码来源:Runner.cs


示例17: MigrationVersionRunner

 public MigrationVersionRunner(IMigrationConventions conventions, IMigrationProcessor processor, IMigrationLoader loader, Assembly assembly, string @namespace, IAnnouncer announcer)
 {
     _migrationConventions = conventions;
     _migrationProcessor = processor;
     _migrationAssembly = assembly;
     _migrationLoader = loader;
     _namespace = @namespace;
     _announcer = announcer;
     _migrationRunner = new MigrationRunner(conventions, processor, announcer, new StopWatch());
     _versionTableMetaData = loader.GetVersionTableMetaData(assembly);
     _versionMigration = new VersionMigration(_versionTableMetaData);
 }
开发者ID:Andrea,项目名称:fluentmigrator,代码行数:12,代码来源:MigrationVersionRunner.cs


示例18: VersionLoader

        public VersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies, IMigrationConventions conventions)
        {
            Runner = runner;
            Processor = runner.Processor;
            Assemblies = assemblies;

            Conventions = conventions;
            VersionTableMetaData = GetVersionTableMetaData();
            VersionMigration = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:15,代码来源:VersionLoader.cs


示例19: Alter

        /// <summary>
        /// Alters the database schema by applying the specified migration. Versioning is unaffected by this operation and any timestamp information on the <paramref name="migration"/> is disregarded.
        /// </summary>
        public void Alter(IMigration migration)
        {
            if (migration is IReversibleMigration)
            {
                Log.Info(LogCategory.General, "Migrations used to modify the database schema directly cannot be reversed.");
            }

            var migrationMetadata = new MigrationMetadata(0, "Bypass", "This migration is being executed without affecting the versioning.");
            var stepMetadata = new MigrationStepMetadata(MigrationDirection.Up, false, new[] { migrationMetadata });
            var batch = new MigrationBatch(new[]
            {
                new MigrationStep(migration, stepMetadata)
            }, Enumerable.Empty<IMigrationMetadata>(), new NoVersioning(), Configuration);
            batch.Execute();
        }
开发者ID:dradovic,项目名称:MigSharp,代码行数:18,代码来源:DbSchema.cs


示例20: ApplyMigration

		void ApplyMigration(IMigration migration, MigrationAttribute attr)
		{
			// we're adding this one
			_logger.MigrateUp(Current, migration.Name);
			if (! DryRun)
			{
                var tProvider = _provider as TransformationProvider;
			    if (tProvider != null) 
                    tProvider.CurrentMigration = migration;

				migration.Up();
                _provider.MigrationApplied(attr.Version, attr.Scope);
				_provider.Commit();
				migration.AfterUp();
			}
		}
开发者ID:CALUMO,项目名称:Migrator.NET,代码行数:16,代码来源:MigrateAnywhere.cs



注:本文中的IMigration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMigrationContext类代码示例发布时间:2022-05-24
下一篇:
C# IMethodSymbol类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap