I am trying to setup my application's structure in VS and I want to "try" and future proof it to a reasonable level. This application will be a WPF re-write of an old Winform app that had followed no conventions. No Layers, Tiers, Acronyms, etc...
It is a fairly largish Enterprise Application. I planned to use Linq To SQL as my DB's are and will most likely always be MS SQL. Also I have an existing skill set with it.
I want to follow MVVM and DDD the best I can but I get confused on the structure of my application when combining these. Let me try and illustrate with some examples.
When I follow MVVM my folder structure may look like this:
Views
Models
ViewModels
Helpers
but how does that fit into a simplistic DDD layered approach where my Project Structure might resemble this:
MyApp.UI
MyApp.Domain
MyApp.Data
Do I put the Models
in the Domain layer or do I have 3 versions of say Person
? This leads to another question of where would I put my Repository and mappings of DB Object to Domain Object? I would assume Data...
Views
I get would go in UI but would ViewModels
also?
Finally, where would I be embedding my Business Logic?
I found the following on CodePlex,DDD Example ,and it has been some help but seems to be for a Web App though that may not matter and is my ignorance shining through.
Don't get me wrong, I know I can have as many folders and call them whatever I want. I am trying to figure out where to place things so that this will be scale-able, not what those places necessarily are called.
The heart of my question might be shown like this.
I have tblPerson
object generated by *.dbml
. This is obvious and would belong in my "Data" layer.
Now I would have Model, DTO, Domain Model, or whatever it's called in a seperate Layer(project?) called Person
. I would need a Mapper
for Person
to tblPerson
that I'm not sure where to put.
Then, I'll have a ViewModel for, say, EditPerson
that would have it's own properties that it pulls from Person
but possibly more as well.
Finally I'd have a View that was bound to that ViewModel....
To be clear that paragraph is FILLED with my assumptions and guesses and I am hoping someone will help clear the air for me or offer there insights so that 6 months to a year from now I am not kicking myself more than I need to.