Issues with Metadata Exceptions????

Sep 19, 2012 at 12:43 PM

Greetings all,

I am trying to run my test app which has a "RunMVC" project and a "Model" project(name and namespace = "TBG3.Model"). The latter is an EF model created via the "Model First" approach thus I have an EDMX file. It is names TBG3.

I have built all the projects and solution without issue. When I run the Solution I get a Metadata Exception. I believe the issue lies with(in web config):

<add name="TBG3" connectionString="metadata=res://*/TBG3.csdl|res://*/TBG3.ssdl|res://*/TBG3.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\mssql2008;initial catalog=TBG3;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

and something to do with all the "res://" bits are referencing the model in a seperate project.

Thoughts?

Many thanks in advance.

Ed

Editor
Sep 19, 2012 at 12:48 PM
Generally you should just copy the connection string from your model project's App.Config and into Web.Config

For my projects, the connection string "name" attribute has a suffix "Container", which yours does not, eg:

<add name="CoffeeShopContainer" connectionString="metadata=res://*/CoffeeShopModel.csdl|res://*/CoffeeShopModel.ssdl|res://*/CoffeeShopModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLExpress;initial catalog=CoffeeShop;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />

searching through the edmx, I see:

...
<!-- CSDL content -->
<edmx:ConceptualModels>
<EntityContainer Name="CoffeeShopContainer" annotation:LazyLoadingEnabled="true">
...

Perhaps this is the problem?

Dan


On 19 September 2012 12:43, ESSB <notifications@codeplex.com> wrote:

From: ESSB

Greetings all,

I am trying to run my test app which has a "RunMVC" project and a "Model" project(name and namespace = "TBG3.Model"). The latter is an EF model created via the "Model First" approach thus I have an EDMX file. It is names TBG3.

I have built all the projects and solution without issue. When I run the Solution I get a Metadata Exception. I believe the issue lies with(in web config):

<add name="TBG3" connectionString="metadata=res://*/TBG3.csdl|res://*/TBG3.ssdl|res://*/TBG3.msl;provider=System.Data.SqlClient;provider connection string="data source=.\mssql2008;initial catalog=TBG3;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />

and something to do with all the "res://" bits are referencing the model in a seperate project.

Thoughts?

Many thanks in advance.

Ed

Read the full discussion online.

To add a post to this discussion, reply to this email (nakedobjects@discussions.codeplex.com)

To start a new discussion for this project, email nakedobjects@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Sep 19, 2012 at 1:00 PM

Just a thought, Ed, triggered by your previous posting:

Did you create the .edmx file as TBG3 in the first place, or did you create it as the default (Model.edmx) and then rename the file at some point?  I seem to recall that I have had issues in the past doing the latter   -  something in either the .edmx file content or the connection string gets out of synch.  Sorry I can't be clearer.  N.B.  This is an Entity Framework issue, though, not a Naked Objects issue.

Sep 19, 2012 at 1:05 PM

Dan and Richard, You are stars......

Actually I copied the wrong bit of the app.config !!! In the original there is :

TBG3Entities

TBG3

TBG3Container

 

.... and I went for "TBG3".... Copying the TBG3Container solved my issue. Huge thanks.

Richard, with regards to the EDMX getting out of sync, yes I have encountered this and have simply recreated it from the DB to solve. Seperate post on EF raised.

Many thanks,

Ed