本文整理汇总了C#中IDictionary.ReadOnlyMergeInto方法的典型用法代码示例。如果您正苦于以下问题:C# IDictionary.ReadOnlyMergeInto方法的具体用法?C# IDictionary.ReadOnlyMergeInto怎么用?C# IDictionary.ReadOnlyMergeInto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDictionary
的用法示例。
在下文中一共展示了IDictionary.ReadOnlyMergeInto方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadInstanceOwnerMetadata
public void ReadInstanceOwnerMetadata(IDictionary<XName, InstanceValue> metadata, bool complete)
{
ThrowIfNoOwner();
ThrowIfNotActive("ReadInstanceOwnerMetadata");
if (InstanceView.InstanceOwnerMetadataConsistency == InstanceValueConsistency.None)
{
return;
}
if (complete)
{
InstanceView.InstanceOwnerMetadata = metadata.ReadOnlyCopy(false);
InstanceView.InstanceOwnerMetadataConsistency = InstanceValueConsistency.InDoubt;
}
else
{
InstanceView.InstanceOwnerMetadata = metadata.ReadOnlyMergeInto(InstanceView.InstanceOwnerMetadata, false);
InstanceView.InstanceOwnerMetadataConsistency |= InstanceValueConsistency.Partial;
}
}
示例2: ReadInstanceKeyMetadata
public void ReadInstanceKeyMetadata(Guid key, IDictionary<XName, InstanceValue> metadata, bool complete)
{
if (key == Guid.Empty)
{
throw Fx.Exception.Argument("key", SRCore.InvalidKeyArgument);
}
ThrowIfNoInstance();
ThrowIfNotActive("ReadInstanceKeyMetadata");
InstanceKeyView keyView;
if (!InstanceView.InstanceKeys.TryGetValue(key, out keyView))
{
if (InstanceView.InstanceKeysConsistency == InstanceValueConsistency.None)
{
throw Fx.Exception.AsError(new InvalidOperationException(SRCore.KeyNotAssociated));
}
Dictionary<Guid, InstanceKeyView> copy = new Dictionary<Guid, InstanceKeyView>(InstanceView.InstanceKeys);
keyView = new InstanceKeyView(key);
if (complete)
{
keyView.InstanceKeyMetadata = metadata.ReadOnlyCopy(false);
keyView.InstanceKeyMetadataConsistency = InstanceValueConsistency.None;
}
else
{
keyView.InstanceKeyMetadata = metadata.ReadOnlyMergeInto(null, false);
keyView.InstanceKeyMetadataConsistency = InstanceValueConsistency.Partial;
}
if (!InstanceView.IsBoundToLock && InstanceView.InstanceState != InstanceState.Completed)
{
keyView.InstanceKeyMetadataConsistency |= InstanceValueConsistency.InDoubt;
}
copy[keyView.InstanceKey] = keyView;
InstanceView.InstanceKeys = new ReadOnlyDictionaryInternal<Guid, InstanceKeyView>(copy);
}
else
{
if (keyView.InstanceKeyMetadataConsistency == InstanceValueConsistency.None)
{
return;
}
if (complete)
{
keyView.InstanceKeyMetadata = metadata.ReadOnlyCopy(false);
keyView.InstanceKeyMetadataConsistency = InstanceView.IsBoundToLock || InstanceView.InstanceState == InstanceState.Completed ? InstanceValueConsistency.None : InstanceValueConsistency.InDoubt;
}
else
{
if ((InstanceView.IsBoundToLock || InstanceView.InstanceState == InstanceState.Completed) && (keyView.InstanceKeyMetadataConsistency & InstanceValueConsistency.InDoubt) != 0)
{
// In this case, prefer throwing out old data and keeping only authoritative data.
keyView.InstanceKeyMetadata = metadata.ReadOnlyMergeInto(null, false);
keyView.InstanceKeyMetadataConsistency = InstanceValueConsistency.Partial;
}
else
{
keyView.InstanceKeyMetadata = metadata.ReadOnlyMergeInto(keyView.InstanceKeyMetadata, false);
keyView.InstanceKeyMetadataConsistency |= InstanceValueConsistency.Partial;
}
}
}
}
示例3: ReadInstanceMetadata
public void ReadInstanceMetadata(IDictionary<XName, InstanceValue> metadata, bool complete)
{
ThrowIfNoInstance();
ThrowIfNotActive("ReadInstanceMetadata");
if (InstanceView.InstanceMetadataConsistency == InstanceValueConsistency.None)
{
return;
}
if (complete)
{
InstanceView.InstanceMetadata = metadata.ReadOnlyCopy(false);
InstanceView.InstanceMetadataConsistency = InstanceView.IsBoundToLock || InstanceView.InstanceState == InstanceState.Completed ? InstanceValueConsistency.None : InstanceValueConsistency.InDoubt;
}
else
{
if ((InstanceView.IsBoundToLock || InstanceView.InstanceState == InstanceState.Completed) && (InstanceView.InstanceMetadataConsistency & InstanceValueConsistency.InDoubt) != 0)
{
// In this case, prefer throwing out old data and keeping only authoritative data.
InstanceView.InstanceMetadata = metadata.ReadOnlyMergeInto(null, false);
InstanceView.InstanceMetadataConsistency = InstanceValueConsistency.Partial;
}
else
{
InstanceView.InstanceMetadata = metadata.ReadOnlyMergeInto(InstanceView.InstanceMetadata, false);
InstanceView.InstanceMetadataConsistency |= InstanceValueConsistency.Partial;
}
}
}
示例4: ReadInstanceOwnerMetadata
public void ReadInstanceOwnerMetadata(IDictionary<XName, InstanceValue> metadata, bool complete)
{
this.ThrowIfNoOwner();
this.ThrowIfNotActive("ReadInstanceOwnerMetadata");
if (this.InstanceView.InstanceOwnerMetadataConsistency != InstanceValueConsistency.None)
{
if (complete)
{
this.InstanceView.InstanceOwnerMetadata = metadata.ReadOnlyCopy(false);
this.InstanceView.InstanceOwnerMetadataConsistency = InstanceValueConsistency.InDoubt;
}
else
{
this.InstanceView.InstanceOwnerMetadata = metadata.ReadOnlyMergeInto(this.InstanceView.InstanceOwnerMetadata, false);
System.Runtime.DurableInstancing.InstanceView instanceView = this.InstanceView;
instanceView.InstanceOwnerMetadataConsistency |= InstanceValueConsistency.Partial;
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:InstancePersistenceContext.cs
示例5: ReadInstanceMetadata
public void ReadInstanceMetadata(IDictionary<XName, InstanceValue> metadata, bool complete)
{
this.ThrowIfNoInstance();
this.ThrowIfNotActive("ReadInstanceMetadata");
if (this.InstanceView.InstanceMetadataConsistency != InstanceValueConsistency.None)
{
if (complete)
{
this.InstanceView.InstanceMetadata = metadata.ReadOnlyCopy(false);
this.InstanceView.InstanceMetadataConsistency = (this.InstanceView.IsBoundToLock || (this.InstanceView.InstanceState == InstanceState.Completed)) ? InstanceValueConsistency.None : InstanceValueConsistency.InDoubt;
}
else if ((this.InstanceView.IsBoundToLock || (this.InstanceView.InstanceState == InstanceState.Completed)) && ((this.InstanceView.InstanceMetadataConsistency & InstanceValueConsistency.InDoubt) != InstanceValueConsistency.None))
{
this.InstanceView.InstanceMetadata = metadata.ReadOnlyMergeInto(null, false);
this.InstanceView.InstanceMetadataConsistency = InstanceValueConsistency.Partial;
}
else
{
this.InstanceView.InstanceMetadata = metadata.ReadOnlyMergeInto(this.InstanceView.InstanceMetadata, false);
System.Runtime.DurableInstancing.InstanceView instanceView = this.InstanceView;
instanceView.InstanceMetadataConsistency |= InstanceValueConsistency.Partial;
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:InstancePersistenceContext.cs
示例6: ReadInstanceKeyMetadata
public void ReadInstanceKeyMetadata(Guid key, IDictionary<XName, InstanceValue> metadata, bool complete)
{
InstanceKeyView view;
if (key == Guid.Empty)
{
throw Fx.Exception.Argument("key", SRCore.InvalidKeyArgument);
}
this.ThrowIfNoInstance();
this.ThrowIfNotActive("ReadInstanceKeyMetadata");
if (!this.InstanceView.InstanceKeys.TryGetValue(key, out view))
{
if (this.InstanceView.InstanceKeysConsistency == InstanceValueConsistency.None)
{
throw Fx.Exception.AsError(new InvalidOperationException(SRCore.KeyNotAssociated));
}
Dictionary<Guid, InstanceKeyView> dictionary = new Dictionary<Guid, InstanceKeyView>(this.InstanceView.InstanceKeys);
view = new InstanceKeyView(key);
if (complete)
{
view.InstanceKeyMetadata = metadata.ReadOnlyCopy(false);
view.InstanceKeyMetadataConsistency = InstanceValueConsistency.None;
}
else
{
view.InstanceKeyMetadata = metadata.ReadOnlyMergeInto(null, false);
view.InstanceKeyMetadataConsistency = InstanceValueConsistency.Partial;
}
if (!this.InstanceView.IsBoundToLock && (this.InstanceView.InstanceState != InstanceState.Completed))
{
view.InstanceKeyMetadataConsistency |= InstanceValueConsistency.InDoubt;
}
dictionary[view.InstanceKey] = view;
this.InstanceView.InstanceKeys = new ReadOnlyDictionary<Guid, InstanceKeyView>(dictionary, false);
}
else if (view.InstanceKeyMetadataConsistency != InstanceValueConsistency.None)
{
if (complete)
{
view.InstanceKeyMetadata = metadata.ReadOnlyCopy(false);
view.InstanceKeyMetadataConsistency = (this.InstanceView.IsBoundToLock || (this.InstanceView.InstanceState == InstanceState.Completed)) ? InstanceValueConsistency.None : InstanceValueConsistency.InDoubt;
}
else if ((this.InstanceView.IsBoundToLock || (this.InstanceView.InstanceState == InstanceState.Completed)) && ((view.InstanceKeyMetadataConsistency & InstanceValueConsistency.InDoubt) != InstanceValueConsistency.None))
{
view.InstanceKeyMetadata = metadata.ReadOnlyMergeInto(null, false);
view.InstanceKeyMetadataConsistency = InstanceValueConsistency.Partial;
}
else
{
view.InstanceKeyMetadata = metadata.ReadOnlyMergeInto(view.InstanceKeyMetadata, false);
view.InstanceKeyMetadataConsistency |= InstanceValueConsistency.Partial;
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:53,代码来源:InstancePersistenceContext.cs