5 Replies
I don't know, it depends on your case
If they need to be shared? Yes
If they don't have to be shared and are only ever referenced by one project? Then there's no reason
Encapsulation also applies to project level
i didn't understand what do you mean "by need to be shared" if it is possible can you give me a example of that
Usually you put models or dtos in a shared project if you have two projects which want to use them, let's say project A and project B. If you don't want to run into an issue where A and B need to reference each other / end up as a cyclic dependency, it's a common practice to put shared models into a common project which A and B reference without having to reference each other
But the main question is: Do you need shared models at all
If only project A ever ends up using them, you can just leave them in A
i am using in service,service contracts
also in dal
also in mvc
but lets say i am just developing a api
is this version of using does any harm to runtime
This isn't necessarily a runtime related issue
It's a matter of organization
If you say that you need a shared dependency layer in your setup, it's fine