Repository pattern - Switch out the database and switch in XML files

Posted by glasto red on Stack Overflow See other posts from Stack Overflow or by glasto red
Published on 2010-04-16T14:00:40Z Indexed on 2010/04/16 14:03 UTC
Read the original article Hit count: 574

Repository pattern - Switch out the database and switch in XML files.

Hello

I have an asp.net MVC 2.0 project and I have followed the Repository pattern.

Periodically, I am losing access to the database server so I want to have another mechanism in place (XML files) to continue developing. It is not possible to have a local version of the db unfortunately!

I thought this would be relatively easy using the Repository pattern, to switch out the db repositories and switch in XML versions. However, I am having real trouble coming up with a solution.

I have tried LinqToXML but then ran into problems trying to return a List of News items as the LinqToXML ToList returns Generic.List

Should I be mapping the XElement list over to the News list by hand? It just seems a bit clunky compared to LinqToSQL attributes on the News class and then simply doing a Table.....ToList();

Any direction would be appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about linq-to-sql