views:

98

answers:

1

I am developing my application in Silverlight with MVVM pattern support. Now I use Sql server 2008, but I am start thinking about in future use also Oracle and XML as storage for my data. I query with linq to sql.

It is pattern which I can use to completely automated and independent from database my application? Where I will only replace few parameters (for example in web.config) to change database, and I write code as little as possible in code behind... Maybe it's chance to connect and implement it in MVVM pattern ?

What do You think ? I work out that in some db i will force to write queries in other ways(which will double or even triple code), cause db have other data types..so it's good idea to create so much independent app?

+1  A: 

If you use Entity Framework with RIA Services with Silverlight, you could potentially swap out your data layer to a different database provider very easily (provided it's one that supports ADO.NET Entity Framework).

Using MVVM is a good idea, but really unrelated to your database independence goal. It's more of a pattern for structuring your application as a whole (which I recommend understanding), but the database access is really all part of your model layer in Model-View-ViewModel, so this isn't going to "help" with this aspect.

Reed Copsey
I thinking about use WCF service with data storage as Model. But I am starting learning about it, so maybe You advice me that this is better or RIA services? I know that one of ADO.NET features is every database support, but what about different data types for example: if I want select something from a table of every database type I should create a interface and implement it for every database i want to use? Cause in Oracle is data type which I don't have in SQL SERVER,and from them I will query with linq to sql, but from XML i use linq to xml, so I don't think that ADO.NET is so swappable...
netmajor
XML won't be easy to use, but I'd highly recommend looking at RIA Services and Entity Framework. WIthout this, you'll end up writing a HUGE amount of code to handle validation, change tracking, object mapping, etc - all of which would just be handled for you in an efficient, elegant way.
Reed Copsey
I want to avoid this Huge amount of code so i try with RIA. But I don't have any experience with it so can You tell my how to connect Silverlight application, MVVM and RIA? I only find that RIA can be ViewModel in MVVM, but from what i must start creating that project? First Silverlight projectm next create 3 folders for MVVM and inside ViewModel folder placed RIA project ?? o.O
netmajor