I noticed that the Entity Framework still has many “automatic” features in its latest version. As always, this is truly a double-edged sword.
In particular, I use the OnModelBuilder event to create my model on the fly in code using fluentAPI (http://msdn.microsoft.com/en-us/library/hh295844(v=vs .103). ASPX). I have a large set of entities, and they do not all comply with Microsoft standards. For example, my identity columns are called Person_id instead of PersonId. Thus, Entity does not always automatically detect the primary key in the table, or at least it does not.
I am not opposed to being explicit when building the model, but I am worried that I’m not always sure which properties and relationships Entity will automatically detect and which ones will be mistakenly ignored or mistakenly identified. . Since most of my entities also have a partial class with auxiliary methods and properties (material for processing enumerations, etc.), I am very afraid that someday Entity will automatically create mappings between things that should not be displayed (failure may be an entity or some unsuspecting programmer).
Is there a way to disable Entity's autodepen function so that I can be 100% explicit in the OnModelBuilder method? Or, at a minimum, how can I find out when I need to add additional matching data (for example, I need to declare a field optional or when a specific navigation property will not be auto-determined)?
Thanks!
Bret
source share