本文整理汇总了C#中Microsoft.Data.Entity.ChangeTracking.Internal.InternalEntityEntry.TryGetSidecar方法的典型用法代码示例。如果您正苦于以下问题:C# InternalEntityEntry.TryGetSidecar方法的具体用法?C# InternalEntityEntry.TryGetSidecar怎么用?C# InternalEntityEntry.TryGetSidecar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Data.Entity.ChangeTracking.Internal.InternalEntityEntry
的用法示例。
在下文中一共展示了InternalEntityEntry.TryGetSidecar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PropertyChanged
public virtual void PropertyChanged(InternalEntityEntry entry, IPropertyBase propertyBase)
{
var snapshot = entry.TryGetSidecar(Sidecar.WellKnownNames.RelationshipsSnapshot);
var property = propertyBase as IProperty;
if (property != null)
{
entry.SetPropertyModified(property);
if (snapshot != null)
{
DetectKeyChange(entry, property, snapshot);
}
}
else
{
var navigation = propertyBase as INavigation;
if (navigation != null
&& snapshot != null)
{
DetectNavigationChange(entry, navigation, snapshot);
}
}
}
示例2: DetectPropertyChanges
private void DetectPropertyChanges(InternalEntityEntry entry)
{
var entityType = entry.EntityType;
if (entityType.HasPropertyChangedNotifications())
{
return;
}
var snapshot = entry.TryGetSidecar(Sidecar.WellKnownNames.OriginalValues);
if (snapshot == null)
{
return;
}
foreach (var property in entityType.GetProperties())
{
if (property.GetOriginalValueIndex() >= 0
&& !Equals(entry[property], snapshot[property]))
{
entry.SetPropertyModified(property);
}
}
}
示例3: DetectRelationshipChanges
private void DetectRelationshipChanges(InternalEntityEntry entry)
{
var snapshot = entry.TryGetSidecar(Sidecar.WellKnownNames.RelationshipsSnapshot);
if (snapshot != null)
{
DetectKeyChanges(entry, snapshot);
DetectNavigationChanges(entry, snapshot);
}
}