Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Created Issue: Fluent API doesn't configure inverse navigation property [1135]

$
0
0
If the specified inverse navigation property wasn't a navigation property to begin with Fluent API doesn't configure it as such.

[Fact]
public void NavigationProperty_doesnt_override_inverse_property()
{
var modelBuilder = new DbModelBuilder();

modelBuilder.Entity<Entity>()
.HasRequired(e => e.InternalNavigationProperty)
.WithMany(e => e.InternalCollectionNavigationProperty);

var databaseMapping = BuildMapping(modelBuilder);

Assert.Equal(
"InternalCollectionNavigationProperty",
databaseMapping.Model.EntityTypes.Single(t => t.Name == "RelatedEntity")
.NavigationProperties.Single().Name);
}


public class Entity
{
public int Id { get; set; }
internal RelatedEntity InternalNavigationProperty { get; set; }
}

public class RelatedEntity
{
public int Id { get; set; }
internal ICollection<Entity> InternalCollectionNavigationProperty { get; set; }
}

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>