public void Aggregate_entity_has_index_with_AggregateId() { var context = new EventStoreDbContext(_dbContextOptions); IEntityType sut = context.Model.FindEntityType(typeof(Aggregate)); IIndex actual = sut.FindIndex(sut.FindProperty("AggregateId")); actual.Should().NotBeNull(); actual.IsUnique.Should().BeTrue(); }
public void Memento_entity_has_index_with_AggregateId() { var sut = new MementoStoreDbContext(_dbContextOptions); IEntityType entity = sut.Model.FindEntityType(typeof(Memento)); IIndex actual = entity.FindIndex(entity.FindProperty("AggregateId")); actual.Should().NotBeNull(); actual.IsUnique.Should().BeTrue(); }
public static IIndex GetIndex([NotNull] this IEntityType entityType, [NotNull] IReadOnlyList <IProperty> properties) { var index = entityType.FindIndex(properties); if (index == null) { throw new ModelItemNotFoundException(Strings.IndexNotFound(Property.Format(properties), entityType.Name)); } return(index); }
public void PersistentEvent_entity_has_index_with_AggregateId_Version() { var context = new EventStoreDbContext(_dbContextOptions); IEntityType sut = context.Model.FindEntityType(typeof(PersistentEvent)); IIndex actual = sut.FindIndex(new[] { sut.FindProperty("AggregateId"), sut.FindProperty("Version"), }); actual.Should().NotBeNull(); actual.IsUnique.Should().BeTrue(); }
public void UniqueIndexedProperty_entity_has_index_with_AggregateId_PropertyName() { var context = new EventStoreDbContext(_dbContextOptions); IEntityType sut = context.Model.FindEntityType(typeof(UniqueIndexedProperty)); IIndex actual = sut.FindIndex(new[] { sut.FindProperty("AggregateType"), sut.FindProperty("AggregateId"), sut.FindProperty("PropertyName"), }); actual.Should().NotBeNull(); actual.IsUnique.Should().BeTrue(); }
/// <summary> /// Gets the index defined on the given property. Returns null if no index is defined. /// </summary> /// <param name="entityType"> The entity type to find the index on. </param> /// <param name="property"> The property to find the index on. </param> /// <returns> The index, or null if none is found. </returns> public static IIndex FindIndex([NotNull] this IEntityType entityType, [NotNull] IProperty property) { Check.NotNull(entityType, nameof(entityType)); return(entityType.FindIndex(new[] { property })); }