views:

81

answers:

1

I have two projects in my Solution. One implements my business logic and has defined entity model of entity framework. When I want to work with classes defined within this project from another project I have some problems in runtime. Actually, the most concerning thing is why I can not instantiate my, so called, TicketEntities(ObjectContext) object from other projects? when I catch following exception:

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

I found out it's brake at:

public partial class TicketEntities : global::System.Data.Objects.ObjectContext
    {
        public TicketEntities() : 
                base("name=TicketEntities", "TicketEntities")
        {
            this.OnContextCreated();
        }

with exception: Unable to load the specified metadata resource. Just to remind you everthing works fine from orginal project.

+3  A: 

You need to copy the Connection string from the original app.config or web.config into the corresponding app.config / web.config in the new project.

Then everything should work.

Alex

Alex James
Funny thing, I came on this idea second before you posted your answer and had problem at first but it seems I didn't save app.config file correctly. So, yes, you are write. Thanks a lot.
Levelbit