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