Reputation: 20907
Can anyone tell me if its possible to extract the linq2sql generated classes into a separate project in c#? - I presume I can just create the files and then copy them to a new project and add a reference to my Data project?
The problem I have is that I have my UI, Service Layer and Data layer...
Currently the data layer also has the generated linq2sql as this is where the dbml is.
So hence I need to have a reference from service to data, which is good! But I have my UI to reference the service layer but I don't think its a good idea for my UI to have a reference to the data layer (as it would need it for the linq2sql classes).
So the only way I see is to pull out the classes and place in a separate project so that all projects can share. Is this good practice?
What naming conventions should I call this project, DTO? POCO? Entities? or similar
I really would love to hear some feed back of how to accomplish this and weather I am the right lines
Upvotes: 1
Views: 137
Reputation: 1203
I'm not 100% sure if this also works for Linq2Sql (I imagine it does), but this is what I do with Linq2Entities:
Once the classes have been generated, I manually move them to a different project. I usually call this project xxxxxx.Model. Entities would probably also be alright but I would stay away from DTO and POCO because those classes are neither. I believe there is a way to do POCO with Linq2Sql, but not if you use the designer. I then add references as needed to the other layers.
Hope this helps.
Upvotes: 1