title: Architecture for .net application with web service
body: <p>I just need a little help how to organize my code. This is not philosophy but real problem. I am looking for a solution that works.For example in php and symfony framework it was crystal clear how to organize the code. In c# .net i feel lost.<br>
  I just want to rewrite from scratch my project reusing some parts.  </p>
  
  <p><strong>Description</strong><br>
  First of all as i am targeting many platforms windows mobile , windows desktop , android ,web it seems that i should expose functionality as web service instead of directly communicating with database. Is this correct ?<br>
  Then i need some client applications. A wpf one ,android and windows mobile.</p>
  
  <p>In wpf i guess that i can use MVVM pattern.  </p>
  
  <p><strong>Questions</strong><br>
  I use postgresql  with ADO.NET and performance is amazing compared to other similar applications. I found that <a href="http://code.google.com/p/dapper-dot-net/" rel="nofollow">Dapper</a> would help a lot and was something that i was looking for. However i am having trouble where to put sql code. Ok i have model classes.. like Customer ,Oder   etc... Then where should i put the sql code ? Should i put CRUD code at separate class ? Currently i have some code in controller classes but I construct a new controller class all the time when i want to something. And this doesnt seem really good.<br>
  Is there any pattern how to organise database code ?</p>