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

Edited Issue: Custom Conventions: Calling LightweightEntityConfiguration.Property isn't enough to include the property in the model [813]

$
0
0
Consider a convention that tries to include all non-public properties in a model

```
modelBuilder
.Entities()
.Configure(c =>
{
var nonPublicProperties =
c.ClrType.GetProperties(BindingFlags.NonPublic|BindingFlags.Instance);

foreach (var p in nonPublicProperties)
{
c.Property(p);
}
});
```

Calling Property isn't enough to have the property included in the model. You need to configure some facet of the property (column name being the easiest).

This is inconsistent with the Fluent API, where calling Property is enough to include the property in the model.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



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