I am utilizing the Entity Framework in order to interface with some WCF services and some MVC3 websites I have built. I am using a database first approach.
What I have created is a library that has a Data, Model, and CRUD folder. Data contains the edmx file and a partial class for my Entities that creates a ToDTO() method. The Model contains a class of each of my entities that I can pass around as an object. The CRUD contains what should be expected - common read, update and delete methods.
My entities are named in the fashion of 'StudentEntity', and my DTO have a simpler name such as 'Student'. So the StudentEntity class has a method ToDTO which returns a Student object.
And my CRUD folder has a class with name Student that contains the CRUD operations for the student entities.
The confusion seems to come when I have another deleloper look over the code, they get confused on which Student they are looking at, the entity, the DTO, or the CRUD class.
How should I change my naming scheme to make it more understandable? Also can you give me any suggestions on cleaning it up a bit. Maybe I do not need the DTO classes and can somehow use extension/reflection to not have a separate class for each ToDTO method.
If I had to keep that same architecture, I would use the following naming conventions:
// Namespaces & folders
// /DTO (Data Transfer Objects classes only)
// /Model (edmx files and utility classes)
// /Data (Repositories)
// /Services (Specialized repositories and business logic classes)
// Naming conventions
StudentDTO // (Data Transfer Object)
Student // (the entity itself)
StudentRepository // (very common and conventional name)
StudentService // (common and conventional name)
My 2 cents, Sincerely, Max