I'm new to .Net and trying to learn things. I'm trying to develop a Prism4 WPF app with
- Visual Studio CSharp 2010 Express Edition,
- Prism v4,
- Unity as IoC,
- SQL Server CE as data store.
I've studied a lot(?) and infuenced by this and this among others, and decided to implement MVVM, Repository and UnitofWork patterns. This application will be a Desktop application with a single user (me:-)
So, I've created a solution with the following projects:
- Shell (Application Layout and startup logic)
- Common (Application Infrastructure and Workflow Logic)
- BusinessModuleA (Views and ViewModels)
- BusinessModuleA.Model (Business Entities - POCO)
- BusinessModuleA.Data (Repositories, Data Access (EF?) )
- BusinessModuleB (Views and ViewModels)
- BusinessModuleB.Model (Business Entities - POCO)
- BusinessModuleB.Data (Repositories, Data Access (EF?) )
My questions are:
- Which projects should reference which projects ?
- If I implement Repositories in 'BusinessModuleX.Data', which is obvious, where should I define IRepositories ?
- Where should I define IUnitOfWork and where should I implement UnitOfWork ?
- Is it ok if I consume UnitOfWork and Repositories in my ViewModels ? Instict says it is bad design.
- If (4) above is bad, then ViewModel should get data via a Service Layer (another project ?). Then, how can we track changes to the entities so as to call the relevant CRUD methods on those objects at the Service Layer?
- Is any of this making any sense or am I missing the big picture ?
Ok, may be I've not made myself clear on what I wanted exactly in my first post. There are not many answers coming up. I'm still looking for answers because while what @Rachel suggested may be effective for the immediate requirements, I want to be careful not to paint myself into a corner. I've an Access Db that I developed for my personal use at Office, and which became kind of a success and now being used by 50+ users and growing. Maintaining and modifying the access code base has been fairly simple at the beginning, but as the app evolved, began to fall apart. That's why I have chosen to re-write everything in .Net/Wpf/Prism and want to make sure that I get the basic design right.
Please discuss.
Meanwhile, I came up with this...