Quantcast
Viewing all articles
Browse latest Browse all 10318

Edited Issue: [Investigate EF6] Convention overrides explicit when complex type [1631]

When combining explicit calls to DbModelBuilder.ComplexType and lightweight conventions that touch properties from the complex type, conventions win.

```
var modelBuilder = new DbModelBuilder();

modelBuilder
.Entity<LightweightEntity>();

modelBuilder
.Types<LightweightEntity>()
.Configure(t => t.Property(e => e.ComplexProperty.StringProperty).HasColumnName("Foo"));

modelBuilder
.ComplexType<LightweightComplexType>()
.Property(e => e.StringProperty)
.HasColumnName("Bar");

var databaseMapping = BuildMapping(modelBuilder);

databaseMapping.AssertValid();

databaseMapping.ShellEdmx();

Assert.NotNull(
databaseMapping.Database
.EntityTypes.Single()
.Properties.SingleOrDefault(p => p.Name == "Bar")); // is Foo
```

Viewing all articles
Browse latest Browse all 10318

Trending Articles



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