开发者

Design Pattern which deals with loading databases

I am trying to write a windows service application which deals with storing values of an application into back end database.My design should be in such a way that user can select the back end database into which the records are to be written.So I was looking for one such design pattern in .net if available,which deals with connecting into multiple databases accordi开发者_JS百科ng to the user choice.


Use Repository Pattern

public interface IDataStore
{
  void AddData(SomeData data);
}

this interface can be implemented for each target database. You can pick the implementation based on user choice. This has nothing to do with .NET though.

You can use Entity Framework to target multiple databases All you have to do is switch to the right ssdl file in the connection string based on user choice.

See Multiple database support with Entity Framework


Any .NET ORM will do this. LINQ-to-SQL, nHibernate, Entity Framework...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜