I have a code first model that I’m using in a project. But now I have other projects that are going to use the same model. Of course, I don’t want to duplicate the model in all projects so the idea is to encapsulate the model in a separate assembly. So far so good, until you also want to “enhance ” the model for some project like adding a ctor with some specific paramaters.
Using partial classes doesn’t work as it needs to be part of the same assembly. Using inheritance doesn’t really work either as entities of the model has ICollection to other entities, so how to make this work ? Am i going in the right direction ?
Not sure I’m very clear, so please be patient 😉
If you need to have shared model, you really need to place it in separate assembly and this assembly must contain everything you need in all projects. So if you need additional constructor you must add that constructor to the shared assembly. If you don’t want to affect other projects dependent on that assembly you must increment the version of the shared assembly (and use strong name).