I have a tech demo application to write, with multiple clients: web client (ASP MVC 3), desktop client (currently it'll be a WCF app, planning to spice it up to Metro later) and a mobile client (Wp7 is the default task, but if I feel like a time-millionaire, I might try MonoDroid too)
I was thinking using WCF for the clients.
I was thinking using EF Model First for back-end.
However my problem arises when I try to figure out where do I put my domain logic (validation, computed properties, etc) without having to manually duplicate everything I already declared in my EF Model.
My first main problem is that EF has a nice object tracking built in (obj.Components.Add(...); db.Save();
), but this functionality isn't available on the clientside easily. Is there a way around it without having to implement my own? (I know how to do that, but that's way too much work for this demo)
My second main problem (as the title suggest) is the domain logic, mainly validations.
- Should I recompile the business objects to clientside and serialize the wcf into the same objects?
- Should I try to work with the WCF generated classes on client-side? (back to the first problem)
Should I try to use shared assemblies?
If I write my logic into MVC controllers, my WCF service won't be able to call them neatly.
- If I write a separate BusinessLayer should that also use EF entities or should I write custom Business Objects? (essentially duplicating everything AGAIN)
- If I use EF entities, I have to partial the validation on, which is ugly (at this point, should I just switch to EF Code first?)
Is there a nice way to use these same validations on client side?
Should I scrap the whole thing and try RIA services?
Oh, so many questions...