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


C# ISdmxObjects.AddIdentifiable方法代码示例

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


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

示例1: AddIfNotDuplicateURN

        /// <summary>
        /// Adds a bean to the container as long as the urn of the bean to add is not contained in the set of URNs.
        ///     <p/>
        ///     If successfully added, will add the bean urn to the set of urns
        /// </summary>
        /// <param name="beans">
        /// container to add to
        /// </param>
        /// <param name="urns">
        /// to exclude
        /// </param>
        /// <param name="bean">
        /// to add to the beans container
        /// </param>
        protected internal void AddIfNotDuplicateURN(ISdmxObjects beans, ISet<Uri> urns, IIdentifiableObject bean)
        {
            if (!urns.Add(bean.Urn))
            {
                throw new SdmxSemmanticException(ExceptionCode.DuplicateUrn, bean.Urn);
            }

            beans.AddIdentifiable(bean);
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:23,代码来源:AbstractSdmxObjectsBuilder.cs

示例2: IncrementVersions


//.........这里部分代码省略.........
                    persistedMaintainable = this._beanRetrievalManager.GetMaintainableObject(currentMaint.AsReference);
                }
                if (persistedMaintainable != null)
                {
                    if (VersionableUtil.IsHigherVersion(persistedMaintainable.Version, currentMaint.Version))
                    {
                        //Modify version of maintainable to be the same as persisted maintainable
                        IMaintainableMutableObject mutableInstance = currentMaint.MutableInstance;
                        mutableInstance.Version = persistedMaintainable.Version;

                        //Remove the Maintainable from the submission - as we've changed the versions
                        sdmxObjects.RemoveMaintainable(currentMaint);

                        //currentMaint = mutableInstance.ImmutableInstance;
                    }
                    if (persistedMaintainable.Version.Equals(currentMaint.Version))
                    {
                        _log.Debug("Latest version is '" + persistedMaintainable.Version + "' perform update checks");
                        if (!currentMaint.DeepEquals(persistedMaintainable, true))
                        {
                            ISet<IIdentifiableObject> allIdentifiables1 = currentMaint.IdentifiableComposites;
                            ISet<IIdentifiableObject> allIdentifiables2 = persistedMaintainable.IdentifiableComposites;

                            bool containsAll = allIdentifiables1.ContainsAll(allIdentifiables2)
                                               && allIdentifiables2.ContainsAll(allIdentifiables1);
                            if (_log.IsInfoEnabled)
                            {
                                string increment = containsAll ? "Minor" : "Major";
                                _log.Info("Perform " + increment + " Version Increment for structure:" + currentMaint.Urn);
                            }

                            //Increment the version number
                            IMaintainableObject newVersion = this.IncrmentVersion(
                                currentMaint, persistedMaintainable.Version, !containsAll);

                            //Remove the Maintainable from the submission
                            sdmxObjects.RemoveMaintainable(currentMaint);

                            //Store the newly updated maintainable in a container for further processing
                            updatedMaintainables.Add(newVersion);
                            oldMaintainables.Add(currentMaint);
                            //Store the old version number mappings to the new version number
                            oldMaintVsNew.Add(currentMaint, newVersion);
                            oldVsNew.Add(currentMaint.AsReference, newVersion.AsReference);

                            string oldVersionNumber = currentMaint.Version;
                            AddOldVsNewReferences(oldVersionNumber, newVersion, oldVsNew);
                        }
                    }
                }
            }

            //Create a set of parent sdmxObjects to not update (regardless of version)
            ISet<IMaintainableObject> filterSet = new HashSet<IMaintainableObject>(updatedMaintainables);
            filterSet.AddAll(sdmxObjects.GetAllMaintainables());

            //Get all the referencing structures to reversion them
            IEnumerable<IMaintainableObject> referencingStructures = this.RecurseUpTree(oldMaintainables, new HashSet<IMaintainableObject>(), filterSet);

            foreach (IMaintainableObject currentReferencingStructure in referencingStructures)
            {
                _log.Info("Perform Minor Version Increment on referencing structure:" + currentReferencingStructure);
                String newVersionNumber;
                if (oldMaintVsNew.ContainsKey(currentReferencingStructure))
                {
                    //The old maintainable is also in the submission and has had it's version number incremented, use this version
                    var tmp = oldMaintVsNew[currentReferencingStructure];
                    //currentReferencingStructure = oldMaintVsNew[currentReferencingStructure];
                    updatedMaintainables.Remove(tmp);
                    newVersionNumber = currentReferencingStructure.Version;
                }
                else
                {
                    newVersionNumber = VersionableUtil.IncrementVersion(currentReferencingStructure.Version, false);
                }
                IMaintainableObject updatedMaintainable =
                    this._crossReferenceReversionEngine.UdpateReferences(
                        currentReferencingStructure, oldVsNew, newVersionNumber);
                AddOldVsNewReferences(currentReferencingStructure.Version, updatedMaintainable, oldVsNew);

                updatedMaintainables.Add(updatedMaintainable);
            }

            foreach (IMaintainableObject currentReferencingStructure in updatedMaintainables)
            {
                IMaintainableObject updatedMaintainable =
                    this._crossReferenceReversionEngine.UdpateReferences(
                        currentReferencingStructure, oldVsNew, currentReferencingStructure.Version);
                sdmxObjects.AddIdentifiable(updatedMaintainable);
            }

            //Update the references of any structures that existed in the submission
            foreach (IMaintainableObject currentReferencingStructure in sdmxObjects.GetAllMaintainables())
            {
                IMaintainableObject updatedMaintainable =
                    this._crossReferenceReversionEngine.UdpateReferences(
                        currentReferencingStructure, oldVsNew, currentReferencingStructure.Version);
                sdmxObjects.AddIdentifiable(updatedMaintainable);
            }
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:101,代码来源:StructureVersionIncrementManager.cs


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