MRCollective / ReliableDbProvider

Provides a Db Provider Factory that uses the Microsoft Transient Fault Handling library to allow for reliable SQL Azure connections when using Entity Framework 4, Entity Framework 5 or Linq 2 SQL.
MIT License
20 stars 4 forks source link

Sample Usage with DbContext and Code First #1

Closed tafs7 closed 11 years ago

tafs7 commented 11 years ago

How do you use this library in a project using EF Code First with DbContext? My context class passes a connection string name into the base DbContext, so I am not sure how I'd wire up the ReliablDbProvider's call to CreateConnection().

robdmoore commented 11 years ago

Hi,

If you are using the connection string name constructor then all you need to do is make sure you set the provider name of the connection string in question to the relevant provider name based on which one you want.

This is described in the "Using the Provider" section in the documentation at: https://github.com/robdmoore/ReliableDbProvider

Note: using code first vs model first etc. makes no difference in the usage of this library.

If you are using Azure Web Sites then note that if you use the config replacement functionality that it will remove your provider name and make it not work!

Let me know how you go...