当前位置: 首页>>代码示例>>C#>>正文


C# XDocument.HasSystemOperations方法代码示例

本文整理汇总了C#中System.Xml.Linq.XDocument.HasSystemOperations方法的典型用法代码示例。如果您正苦于以下问题:C# XDocument.HasSystemOperations方法的具体用法?C# XDocument.HasSystemOperations怎么用?C# XDocument.HasSystemOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Linq.XDocument的用法示例。


在下文中一共展示了XDocument.HasSystemOperations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HasSystemOperations_should_return_true_when_any_element_has_is_system_attribute

        public void HasSystemOperations_should_return_true_when_any_element_has_is_system_attribute()
        {
            var xdocument = new XDocument(new XElement("foo", new XAttribute(EdmXNames.IsSystem, "true")));

            Assert.True(xdocument.HasSystemOperations());
        }
开发者ID:junxy,项目名称:entityframework,代码行数:6,代码来源:XDocumentExtensionsTests.cs

示例2: Diff

        public IEnumerable<MigrationOperation> Diff(XDocument sourceModel, XDocument targetModel, bool? includeSystemOperations = null)
        {
            DbProviderInfo providerInfo;

            _source
                = new ModelMetadata
                      {
                          Model = sourceModel,
                          StoreItemCollection = sourceModel.GetStoreItemCollection(out providerInfo),
                          ProviderManifest = GetProviderManifest(providerInfo),
                          ProviderInfo = providerInfo
                      };

            _target
                = new ModelMetadata
                      {
                          Model = targetModel,
                          StoreItemCollection = targetModel.GetStoreItemCollection(out providerInfo),
                          ProviderManifest = GetProviderManifest(providerInfo),
                          ProviderInfo = providerInfo
                      };

            _consistentProviders
                = _source.ProviderInfo.ProviderInvariantName.EqualsIgnoreCase(
                    _target.ProviderInfo.ProviderInvariantName)
                  && _source.ProviderInfo.ProviderManifestToken.EqualsIgnoreCase(
                      _target.ProviderInfo.ProviderManifestToken);

            var renamedColumns = FindRenamedColumns().ToList();
            var addedColumns = FindAddedColumns(renamedColumns).ToList();
            var alteredColumns = FindChangedColumns().ToList();
            var removedColumns = FindRemovedColumns(renamedColumns).ToList();
            var renamedTables = FindRenamedTables().ToList();
            var movedTables = FindMovedTables().ToList();
            var addedTables = FindAddedTables(renamedTables).ToList();

            var columnNormalizedSourceModel = BuildColumnNormalizedSourceModel(renamedColumns);

            var addedForeignKeys = FindAddedForeignKeys(columnNormalizedSourceModel).ToList();
            var removedTables = FindRemovedTables(renamedTables).ToList();
            var removedForeignKeys = FindRemovedForeignKeys(columnNormalizedSourceModel).ToList();
            var changedPrimaryKeys = FindChangedPrimaryKeys(columnNormalizedSourceModel).ToList();

            if (includeSystemOperations == null)
            {
                includeSystemOperations
                    = sourceModel.HasSystemOperations() && targetModel.HasSystemOperations();
            }

            return renamedTables
                .Concat<MigrationOperation>(movedTables)
                .Concat(removedForeignKeys)
                .Concat(removedForeignKeys.Select(fko => fko.CreateDropIndexOperation()))
                .Concat(renamedColumns)
                .Concat(addedTables)
                .Concat(addedColumns)
                .Concat(alteredColumns)
                .Concat(changedPrimaryKeys)
                .Concat(addedForeignKeys)
                .Concat(addedForeignKeys.Select(fko => fko.CreateCreateIndexOperation()))
                .Concat(removedColumns)
                .Concat(removedTables)
                .Where(o => (includeSystemOperations == true) || !o.IsSystem)
                .ToList();
        }
开发者ID:junxy,项目名称:entityframework,代码行数:65,代码来源:EdmModelDiffer.cs

示例3: RevertMigration

        internal override void RevertMigration(string migrationId, DbMigration migration, XDocument sourceModel, XDocument targetModel)
        {
            bool? includeSystemOps = null;

            if (ReferenceEquals(targetModel, _emptyModel.Value))
            {
                includeSystemOps = true;

                if (!sourceModel.HasSystemOperations())
                {
                    // upgrade scenario, inject the history model
                    _historyRepository
                        .AppendHistoryModel(
                            sourceModel,
                            new DbProviderInfo(_usersContextInfo.ConnectionProviderName, _providerManifestToken));
                }
            }

            var systemOperations
                = _modelDiffer.Diff(sourceModel, targetModel, includeSystemOps)
                    .Where(o => o.IsSystem);

            migration.Down();

            ExecuteOperations(migrationId, targetModel, migration.Operations.Concat(systemOperations), downgrading: true);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:26,代码来源:DbMigrator.cs

示例4: RevertMigration

        internal override void RevertMigration(string migrationId, DbMigration migration, XDocument sourceModel, XDocument targetModel)
        {
            bool? includeSystemOps = null;

            if (ReferenceEquals(targetModel, _emptyModel.Value)
                && !_historyRepository.IsShared())
            {
                includeSystemOps = true;

                if (!sourceModel.HasSystemOperations())
                {
                    // upgrade scenario, inject the history model
                    AttachHistoryModel(sourceModel);
                }
            }

            var systemOperations
                = _modelDiffer.Diff(sourceModel, targetModel, includeSystemOps)
                              .Where(o => o.IsSystem);

            migration.Down();

            ExecuteOperations(migrationId, targetModel, migration.Operations.Concat(systemOperations), downgrading: true);
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:24,代码来源:DbMigrator.cs


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