本文整理汇总了C#中ISdmxObjects.GetAllMaintinables方法的典型用法代码示例。如果您正苦于以下问题:C# ISdmxObjects.GetAllMaintinables方法的具体用法?C# ISdmxObjects.GetAllMaintinables怎么用?C# ISdmxObjects.GetAllMaintinables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISdmxObjects
的用法示例。
在下文中一共展示了ISdmxObjects.GetAllMaintinables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveReferencesInternal
/// <summary>
/// The resolve references internal.
/// </summary>
/// <param name="beans">
/// The beans.
/// </param>
/// <param name="retrievalManager">
/// The retrieval manager.
/// </param>
/// <param name="populateMissingMap">
/// The populate missing map.
/// </param>
/// <returns>
/// The <see cref="IDictionary"/>.
/// </returns>
/// <exception cref="ReferenceException">
/// </exception>
private IDictionary<IIdentifiableObject, ISet<IIdentifiableObject>> ResolveReferencesInternal(
ISdmxObjects beans,
ISdmxRetrievalManager retrievalManager,
IDictionary<IIdentifiableObject, ISet<ICrossReference>> populateMissingMap)
{
this._structureRetrievalManager = retrievalManager;
/* foreach */
foreach (IAgency currentAgency in beans.Agencies)
{
this._agencies.Add(currentAgency.FullId, currentAgency);
}
// Add all the top level beans to the maintainables list
beans.GetAllMaintinables().AddAll(this._maintianables);
// LOOP THROUGH ALL THE BEANS AND RESOLVE ALL THE REFERENCES
if (this._resolveAgencies)
{
/* foreach */
foreach (IMaintainableObject currentBean in beans.GetAllMaintinables())
{
try
{
this.ResoveAgency(currentBean);
}
catch (ReferenceException e)
{
throw new ReferenceException(
e,
ExceptionCode.ReferenceError,
SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Agency),
currentBean.StructureType,
currentBean.ToString());
}
}
}
ISet<IMaintainableObject> loopSet = new HashSet<IMaintainableObject>();
this._maintianables.AddAll(loopSet);
/* foreach */
foreach (IMaintainableObject currentMaintainable in loopSet)
{
this._log.Debug("Resolving References For : " + currentMaintainable.Urn);
ISet<ICrossReference> crossReferences0 = currentMaintainable.CrossReferences;
this._log.Debug("Number of References : " + crossReferences0.Count);
int i = 0;
/* foreach */
foreach (ICrossReference crossReference in crossReferences0)
{
i++;
if (this._log.IsDebugEnabled)
{
this._log.Debug(
"Resolving Reference " + i + ": " + crossReference + " - referenced from -"
+ crossReference.ReferencedFrom.StructureType);
}
try
{
this.StoreRef(
crossReference.ReferencedFrom, this.ResolveCrossReference(crossReference, retrievalManager));
}
catch (ReferenceException e1)
{
HandleMissingReference(e1, populateMissingMap);
}
}
}
return this._crossReferences;
}
示例2: GetMissingAgencies
/// <summary>
/// For the included <paramref name="sdmxObjects"/>, returns a map of agency URN to maintainable Bean that references the agency
/// </summary>
/// <param name="sdmxObjects">
/// The included <c>SDMX</c> objects
/// </param>
/// <param name="retrievalManager">
/// The <see cref="ISdmxRetrievalManager"/>
/// </param>
/// <returns>
/// The included <paramref name="sdmxObjects"/>, returns a map of agency URN to maintainable Bean that references the agency
/// </returns>
public virtual IDictionary<string, ISet<IMaintainableObject>> GetMissingAgencies(
ISdmxObjects sdmxObjects, ISdmxRetrievalManager retrievalManager)
{
ISet<string> agencyIds = new HashSet<string>();
/* foreach */
var agencies = sdmxObjects.Agencies;
foreach (IAgency acy in agencies)
{
agencyIds.Add(acy.FullId);
}
IDictionary<string, ISet<IMaintainableObject>> returnMap =
new Dictionary<string, ISet<IMaintainableObject>>();
/* foreach */
var maintainableObjects = sdmxObjects.GetAllMaintinables();
foreach (IMaintainableObject currentMaint in maintainableObjects)
{
string referencedAgencyId = currentMaint.AgencyId;
if (!agencyIds.Contains(referencedAgencyId))
{
if (retrievalManager != null)
{
try
{
IAgency acy0 = retrievalManager.GetAgency(referencedAgencyId);
if (acy0 != null)
{
agencyIds.Add(acy0.FullId);
continue;
}
}
catch (Exception th)
{
Console.Error.WriteLine(th.StackTrace);
}
}
ISet<IMaintainableObject> maintainables;
if (!returnMap.TryGetValue(referencedAgencyId, out maintainables))
{
maintainables = new HashSet<IMaintainableObject>();
returnMap.Add(referencedAgencyId, maintainables);
}
maintainables.Add(currentMaint);
}
}
return returnMap;
}