8

I use ASP.NET Webforms and Entity Framework 4 and this is my .edmx file screenshot because I don't know what code to post here:

enter image description here

And this is my connection string in my web.config file:

<add name="tebimir_db_tebimEntities" 
     connectionString="metadata=res://*/DataAccessLayer.tebimir_db_tebim.csdl|res://*/DataAccessLayer.tebimir_db_tebim.ssdl|res://*/DataAccessLayer.tebimir_db_tebim.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tebim.ir,9993;initial catalog=tebimir_db_tebim;persist security info=True;user id=tebimir_dbadmin;password=qwerty*2607548;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" />

My .edmx file in inside a folder named DataAccessLayer. When I use Entity Framework, it works fine and there is no problem but ONLY when I create an entityDataSource control and want to assign my .edmx to it, I get an error that the metadata could not be found, otherwise it works correctly.

I mean I can access data using Entity Framework. I checked all the questions related in stack-overflow but could not find an answer. Please help.

enter image description here

These are additional information in case it can help you:

enter image description here enter image description here

12
  • I am reading it.. :-) Commented May 26, 2016 at 9:54
  • Are you sure that you have 'Build' your project before using the entity datasource control? Commented May 26, 2016 at 9:56
  • Yes. lots of times! Commented May 26, 2016 at 9:57
  • stackoverflow.com/questions/4739959/… Commented May 26, 2016 at 10:01
  • i have read them all, my error is only when I want to work with EntityDataSource. Thanks :) Commented May 26, 2016 at 10:03

2 Answers 2

4
+50

First of all, you will not face this issue on VS 2012. This is Visual Studio 2013 specific issue and I was able to reproduce it. Here is the solution:

  1. Double click on your edmx file in solution explorer to open it in edmx designer. Right click on empty surface. Click "Model Browser" from context menu.
  2. In Model Browser window select the conceptual model node. It will be parallel to and just below diagrams node. By default name of this node is database name concatenated with string "Model". Like if my database name is Employee then this node is seen as EmployeeModel. Right click on conceptual model node. Click on Properties from the context menu.
  3. Change the value of "Meta Artifact Processing" property from "Embed in Output Assembly" to "Copy to Output Directory"

enter image description here

Now you can point your entityDataSource control to this edmx through Configure Data Source wizard without error. See the note in the ".edmx file properties" section of below link:

https://msdn.microsoft.com/en-us/library/cc982042%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396

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

6 Comments

I did, That way I get the same error when im not using entityDataSource control to access my data. EntityDataSource is ok now but I cant access my data directly.
I had done this before. I agree that this answer is correct about EntityDataSource but not an answer about the problem. Thanks any way
What do you mean by this That way I get the same error when im not using entityDataSource control to access my data? What is that error? Are you saying that after making all the changes I've suggested when you actually bind the edmx to control, the entityDataSource doesn't get the records present in database?
No! when I bind the edmx to control, say gridview, fields are not retrieved. column names are unknown, when i refresh gridview schema it gives error. i dont know. whatever i just created another project and recreated everything from start. I really hate microsoft products.
Anyway i give you the bounty. thanks for your efforts.
|
3

It seems that you have misconfigured the property MetadataArtifactProcessing.

Try setting MetadataArtifactProcessing = EntityDeploy

2 Comments

upvote to encourage you to keep answering questions :)
Well, comments are comments, not answers. It's better to upvote real answers.

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.