-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Milestone
Description
EF may be able to call several of the constructors defined on an entity type. By convention, we should always choose the one with the most number of services that can map--similar to D.I. However, when mapping scalar properties, we could:
- Call the parameterless constructor (or the constructor with only services) if it is available. This would avoid any breaking change because this is the kind of constructor EF has always called.
- Call the constructor with the most scalar properties that match. The reasoning for this is that if a constructor that matches has been defined, then it could very well be intended that we call it. However, it may do extra validation or other things that are not needed/slow/harmful if called by EF
Note that if only one constructor is defined, then EF will use it--this is just about the case when multiple are defined.
weitzhandler, ErroneousFatality and lonix1