本文整理汇总了C#中EntityType.OriginalValueCount方法的典型用法代码示例。如果您正苦于以下问题:C# EntityType.OriginalValueCount方法的具体用法?C# EntityType.OriginalValueCount怎么用?C# EntityType.OriginalValueCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityType
的用法示例。
在下文中一共展示了EntityType.OriginalValueCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Only_required_properties_have_original_value_indexes_when_using_lazy_original_values
public void Only_required_properties_have_original_value_indexes_when_using_lazy_original_values()
{
var entityType = new EntityType(typeof(FullNotificationEntity), new Model());
entityType.GetOrAddProperty("Name", typeof(string)).IsConcurrencyToken = true;
entityType.GetOrAddProperty("Id", typeof(int));
Assert.Equal(-1, entityType.GetProperty("Id").GetOriginalValueIndex());
Assert.Equal(0, entityType.GetProperty("Name").GetOriginalValueIndex());
Assert.Equal(1, entityType.OriginalValueCount());
}
示例2: All_properties_have_original_value_indexes_when_using_eager_original_values
public void All_properties_have_original_value_indexes_when_using_eager_original_values()
{
var entityType = new EntityType(typeof(FullNotificationEntity), new Model()) { UseEagerSnapshots = true };
entityType.AddProperty(FullNotificationEntity.NameProperty);
entityType.AddProperty(FullNotificationEntity.IdProperty);
Assert.Equal(0, entityType.GetProperty("Id").GetOriginalValueIndex());
Assert.Equal(1, entityType.GetProperty("Name").GetOriginalValueIndex());
Assert.Equal(2, entityType.OriginalValueCount());
}
示例3: Indexes_are_rebuilt_when_more_properties_added_or_relevant_state_changes
public void Indexes_are_rebuilt_when_more_properties_added_or_relevant_state_changes()
{
var entityType = new EntityType(typeof(FullNotificationEntity), new Model());
var nameProperty = entityType.GetOrAddProperty("Name", typeof(string));
entityType.GetOrAddProperty("Id", typeof(int), shadowProperty: true).IsConcurrencyToken = true;
Assert.Equal(0, entityType.GetProperty("Id").Index);
Assert.Equal(1, entityType.GetProperty("Name").Index);
Assert.Equal(0, entityType.GetProperty("Id").GetShadowIndex());
Assert.Equal(-1, entityType.GetProperty("Name").GetShadowIndex());
Assert.Equal(0, entityType.GetProperty("Id").GetOriginalValueIndex());
Assert.Equal(-1, entityType.GetProperty("Name").GetOriginalValueIndex());
Assert.Equal(1, entityType.ShadowPropertyCount());
Assert.Equal(1, entityType.OriginalValueCount());
var gameProperty = entityType.GetOrAddProperty("Game", typeof(int), shadowProperty: true);
gameProperty.IsConcurrencyToken = true;
var maneProperty = entityType.GetOrAddProperty("Mane", typeof(int), shadowProperty: true);
maneProperty.IsConcurrencyToken = true;
Assert.Equal(0, entityType.GetProperty("Game").Index);
Assert.Equal(1, entityType.GetProperty("Id").Index);
Assert.Equal(2, entityType.GetProperty("Mane").Index);
Assert.Equal(3, entityType.GetProperty("Name").Index);
Assert.Equal(0, entityType.GetProperty("Game").GetShadowIndex());
Assert.Equal(1, entityType.GetProperty("Id").GetShadowIndex());
Assert.Equal(2, entityType.GetProperty("Mane").GetShadowIndex());
Assert.Equal(-1, entityType.GetProperty("Name").GetShadowIndex());
Assert.Equal(0, entityType.GetProperty("Game").GetOriginalValueIndex());
Assert.Equal(1, entityType.GetProperty("Id").GetOriginalValueIndex());
Assert.Equal(2, entityType.GetProperty("Mane").GetOriginalValueIndex());
Assert.Equal(-1, entityType.GetProperty("Name").GetOriginalValueIndex());
Assert.Equal(3, entityType.ShadowPropertyCount());
Assert.Equal(3, entityType.OriginalValueCount());
gameProperty.IsConcurrencyToken = false;
nameProperty.IsConcurrencyToken = true;
Assert.Equal(0, entityType.GetProperty("Game").Index);
Assert.Equal(1, entityType.GetProperty("Id").Index);
Assert.Equal(2, entityType.GetProperty("Mane").Index);
Assert.Equal(3, entityType.GetProperty("Name").Index);
Assert.Equal(0, entityType.GetProperty("Game").GetShadowIndex());
Assert.Equal(1, entityType.GetProperty("Id").GetShadowIndex());
Assert.Equal(2, entityType.GetProperty("Mane").GetShadowIndex());
Assert.Equal(-1, entityType.GetProperty("Name").GetShadowIndex());
Assert.Equal(-1, entityType.GetProperty("Game").GetOriginalValueIndex());
Assert.Equal(0, entityType.GetProperty("Id").GetOriginalValueIndex());
Assert.Equal(1, entityType.GetProperty("Mane").GetOriginalValueIndex());
Assert.Equal(2, entityType.GetProperty("Name").GetOriginalValueIndex());
Assert.Equal(3, entityType.ShadowPropertyCount());
Assert.Equal(3, entityType.OriginalValueCount());
gameProperty.IsShadowProperty = false;
nameProperty.IsShadowProperty = true;
Assert.Equal(0, entityType.GetProperty("Game").Index);
Assert.Equal(1, entityType.GetProperty("Id").Index);
Assert.Equal(2, entityType.GetProperty("Mane").Index);
Assert.Equal(3, entityType.GetProperty("Name").Index);
Assert.Equal(-1, entityType.GetProperty("Game").GetShadowIndex());
Assert.Equal(0, entityType.GetProperty("Id").GetShadowIndex());
Assert.Equal(1, entityType.GetProperty("Mane").GetShadowIndex());
Assert.Equal(2, entityType.GetProperty("Name").GetShadowIndex());
Assert.Equal(-1, entityType.GetProperty("Game").GetOriginalValueIndex());
Assert.Equal(0, entityType.GetProperty("Id").GetOriginalValueIndex());
Assert.Equal(1, entityType.GetProperty("Mane").GetOriginalValueIndex());
Assert.Equal(2, entityType.GetProperty("Name").GetOriginalValueIndex());
Assert.Equal(3, entityType.ShadowPropertyCount());
Assert.Equal(3, entityType.OriginalValueCount());
}