3

I am currently using EntityFramework 4 with POCO objects. The POCO objects are located in their own .net project (project.Models). The Context is located in the DAL project (project.DAL). I have multiple other projects that I wish to use the context/models, for Example:

project.Website

project.Webservice

project.ConsoleApplication

Question: How do I set the Context's connection string myself?
I have noticed that the Context object automatically finds the connection string in the web.config of the website if I add it there. Do I need to do something similiar for all the other projects? This seems inelegant and i think i'd rather have a way to manually configure it from my own config file or something.

Thanks! AFrieze

1 Answer 1

5

You can pass a connection string as the first argument to the ObjectContext constructor. Read it from wherever you like and pass it explicitly, if that's what you want.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Also found a nice tutorial here: blogs.msdn.com/b/adonet/archive/2011/01/27/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.