public void DiscoverKeyProperties_throws_when_multiple_ids() { var entityType = CreateEntityType <EntityWithMultipleIds>(); var convention = new KeyConvention(); var ex = Assert.Throws <InvalidOperationException>(() => convention.Apply(entityType)); Assert.Equal( Strings.FormatMultiplePropertiesMatchedAsKeys("ID", typeof(EntityWithMultipleIds).Name), ex.Message); }
protected virtual ConventionSet CreateConventionSet() { var conventions = new ConventionSet(); conventions.EntityTypeAddedConventions.Add(new PropertyDiscoveryConvention()); conventions.EntityTypeAddedConventions.Add(new KeyDiscoveryConvention()); conventions.EntityTypeAddedConventions.Add(new RelationshipDiscoveryConvention()); var keyConvention = new KeyConvention(); conventions.KeyAddedConventions.Add(keyConvention); conventions.ForeignKeyAddedConventions.Add(new ForeignKeyPropertyDiscoveryConvention()); conventions.ForeignKeyRemovedConventions.Add(keyConvention); return conventions; }
private static InternalModelBuilder CreateInternalModelBuilder() { var conventions = new ConventionSet(); conventions.EntityTypeAddedConventions.Add(new PropertyDiscoveryConvention()); conventions.EntityTypeAddedConventions.Add(new KeyDiscoveryConvention()); var keyConvention = new KeyConvention(); conventions.KeyAddedConventions.Add(keyConvention); conventions.ForeignKeyRemovedConventions.Add(keyConvention); return new InternalModelBuilder(new Model(), conventions); }