Data layer abstraction

Topics: Prism v4 - WPF 4
Feb 10, 2011 at 3:53 PM


I'm trying to build my first WPF 4 app using PRISM/MEF/MVVM. Actually the application should use Lucene.NET Indexes as data source (only search/read access). I want to avoid that in my modules (Service classes) there is direct access to Lucene.NET (or eventually Linq to Lucene) in order to make the complete data layer / data source changeable easily (e.g. for achieving to alternatively choose a SQL Server database instead to query against). Whats the best practice to do that? Are there any examples for abstraction of the whole data access layer to a single assembly, which is replaceably by another implementation easily?? Any suggestions?

Thanks in advance!


Best Regards


Feb 10, 2011 at 8:48 PM

Hi Andreas,

Although Prism doesn´t provide guidance to Data Connectivity out of the box, this challenge could be covered using a dependency injection container like Prism does.

Using Unity or Mef you could inject into the services your Data Access Layers in order to perform your operations(search or read). Each of this data access component will know how to handle every operation accordingly, depending your desired logic.

Additionally, you might find this MSDN article helpful.

I hope you find this information useful.


Miguel Bronzovic