本文整理汇总了C#中EntityType.RemoveIndex方法的典型用法代码示例。如果您正苦于以下问题:C# EntityType.RemoveIndex方法的具体用法?C# EntityType.RemoveIndex怎么用?C# EntityType.RemoveIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityType
的用法示例。
在下文中一共展示了EntityType.RemoveIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveIndex_check_arguments
public void RemoveIndex_check_arguments()
{
var entityType = new EntityType(typeof(Order));
Assert.Equal(
"index",
// ReSharper disable once AssignNullToNotNullAttribute
Assert.Throws<ArgumentNullException>(() => entityType.RemoveIndex(null)).ParamName);
}
示例2: Can_add_retrieve_and_remove_indexes
public void Can_add_retrieve_and_remove_indexes()
{
var entityType = new EntityType(typeof(Order), new Model());
var property1 = entityType.GetOrAddProperty(Order.IdProperty);
var property2 = entityType.GetOrAddProperty(Order.CustomerIdProperty);
Assert.Equal(0, entityType.Indexes.Count);
Assert.Null(entityType.RemoveIndex(new Index(new[] { property1 })));
var index1 = entityType.GetOrAddIndex(property1);
Assert.Equal(1, index1.Properties.Count);
Assert.Same(index1, entityType.GetIndex(property1));
Assert.Same(index1, entityType.FindIndex(property1));
Assert.Same(property1, index1.Properties[0]);
var index2 = entityType.AddIndex(new[] { property1, property2 });
Assert.Equal(2, index2.Properties.Count);
Assert.Same(index2, entityType.GetOrAddIndex(new[] { property1, property2 }));
Assert.Same(index2, entityType.FindIndex(new[] { property1, property2 }));
Assert.Same(property1, index2.Properties[0]);
Assert.Same(property2, index2.Properties[1]);
Assert.Equal(2, entityType.Indexes.Count);
Assert.Same(index1, entityType.Indexes[0]);
Assert.Same(index2, entityType.Indexes[1]);
Assert.Same(index1, entityType.RemoveIndex(index1));
Assert.Null(entityType.RemoveIndex(index1));
Assert.Equal(1, entityType.Indexes.Count);
Assert.Same(index2, entityType.Indexes[0]);
Assert.Same(index2, entityType.RemoveIndex(new Index(new[] { property1, property2 })));
Assert.Equal(0, entityType.Indexes.Count);
}
示例3: Can_add_retrieve_and_remove_indexes
public void Can_add_retrieve_and_remove_indexes()
{
var entityType = new EntityType(typeof(Order));
var property1 = entityType.AddProperty(Order.IdProperty);
var property2 = entityType.AddProperty(Order.CustomerIdProperty);
Assert.Equal(0, entityType.Indexes.Count);
var index1 = entityType.AddIndex(property1);
Assert.Equal(1, index1.Properties.Count);
Assert.Same(property1, index1.Properties[0]);
var index2 = entityType.AddIndex(property1, property2);
Assert.Equal(2, index2.Properties.Count);
Assert.Same(property1, index2.Properties[0]);
Assert.Same(property2, index2.Properties[1]);
Assert.Equal(2, entityType.Indexes.Count);
Assert.Same(index1, entityType.Indexes[0]);
Assert.Same(index2, entityType.Indexes[1]);
entityType.RemoveIndex(index1);
Assert.Equal(1, entityType.Indexes.Count);
Assert.Same(index2, entityType.Indexes[0]);
entityType.RemoveIndex(index2);
Assert.Equal(0, entityType.Indexes.Count);
}