What's the best way to access a secondary db in my Orchard module?

Topics: Writing modules
Mar 19, 2013 at 6:22 AM
What is the best way to access a second db in my Orchard module?

The db is an sql server database and not the same db Orchard uses.

I've tried EF4 with a couple oddities: 1) I had to add the connection to Orchard.Web\web.config instead of MyModule\Web.config. 2) I have to surround all my db access with a Transaction scope of suppress.

Should I be using nhibernate instead?
Does nHibernate in Orchard allow access to a second db?
How do I get the connection string to be read from my module instead of the root config?
Coordinator
Mar 19, 2013 at 7:04 AM
It doesn't matter what you use to access an external db. No matter what, you will have to store the connection string somewhere (does EF really require that it is in web.config?), and you will have to opt out of the ambient transaction.

Not sure what the problem is with the connection string. Can't you store that in site settings, retrieve it when you need it and use it?
Mar 19, 2013 at 5:24 PM
Thanks.