Tweet
SIGN UP
MEMBER LOGIN:
TECHNOLOGIES
.NET 4.5
.NET Remoting in C#
Active Directory C#
ADO.NET in C#
AJAX in C#
Algorithms in C#
Android Programming
Articles C#
ASP, JavaScript, CSS
ASP.NET Controls in C#
ASP.NET MVC with C#
ASP.NET Programming
BizTalk Server
C# Assemblies
C# Language
C# Tutorials
C, C++, MFC
Career Advice
Chapters
Cloud Computing
COBOL.NET
Coding Best Practices
COM Interop
Compact Framework
Cryptography C#
Crystal Reports C#
Current Affairs
Custom Controls C#
Databases & DBA
Deployment
Design & Architecture
DirectX C#
Enterprise Development
Error Zone
Exception Handling C#
Expression Studio
F#
Files, Directories in C#
Financial Applications
Games Programming C#
GDI+ & Graphics
Hardware
How do I
HTML 5
Internet & Web
iPhone/iPad
Java
Java and .NET
JQuery
JSP
Leadership
Learn .NET
LINQ with C#
Metro Style Apps in C#
Mobile & Embedded
MonoDevelop
MSMQ in C#
Multithreading in C#
Networking
Office Development
OOP/OOD
Operating Systems
PHP
Printing in C#
Products
Project Management
Reports using C#
Robotics & Hardware
Security in .NET
SharePoint
Silverlight with C#
Smart Devices
Speech in C#
SQL
SQL Server 2012
String in C#
Team Foundation & VSS
Testing
Visual Basic .NET
Visual C#
Visual Studio .NET
Visual Studio 11
Visual Studio 2010
VS LightSwitch 2011
WCF with C#
Web Forms C#
Web Services in C#
WebForms Controls
Windows 8 in C#
Windows Controls C#
Windows Forms C#
Windows Phone in C#
Windows PowerShell
Windows Services in C#
Workflow Foundation in C#
WPF with C#
XAML with C#
XML in C#
XNA with C#
FORUMS
BLOGS
VIDEOS
INTERVIEWS
CERTIFICATIONS
DOWNLOADS
BOOKS
LINKS
NEWS
Learn .NET in 60 days – Part 1 (13 Labs)
Learn MVC (Model view controller) Step by Step ...
Learn C# Corner - Home
Using Border Radius and Gradients in CSS3: Part I
Learn C# Corner - Footer
Learn .NET and C# in 60 Days Lab13(Day 5): - C ...
iPhone 5 First Look
Samsung Galaxy Note Review
WCF - Authentication and Authorization in Ente ...
How to write a good article on C# Corner
Blog
Metadata Exception in Entity Framework Connection Strings
Posted by
John Penn
in
Blogs
|
.NET 4.5
on
Feb 02, 2012
My experience with a cryptic error message encountered during evaluation of Entity Framework 4.0 with SQL Server Compact Edition 4.0.
Tweet
502
2
0
After generating the entity model and classes for my existing SqlCe database, I tried to run some LINQ queries against it. The following exception was thrown as soon as I tried to instantiate the ObjectContext:
unable to load the specified metadata resource
The metadata that the error message refers to is in the connection string. This was automatically generated for me, so why would it fail? After lots of googling, I found
this page on Craig Stuntz's blog
that has some very handy troubleshooting tips. He lists several possibilities as to why the metadata would be the cause of the error, but in my case it was the use of the asterisks in the paths in the embedded resources:
metadata=res://*/MyModel.csdl|res://*/MyModel.ssdl|res://*/MyModel.msl
As Craig points out, it is better to replace the asterisks with the explicit name of the assembly that contains the model as in:
metadata=res://MyDAL/MyModel.csdl|res://MyDAL/MyModel.ssdl|res://MyDAL/MyModel.msl
If this doesn't work for you, you may need to use a tool such as Reflector to find the exact path of the resources within the compiled DLL. In my case, my model was in a sub-directory of the DAL project (named "Client"), so my metadata now looks like this:
metadata=res://MyDAL/Client.MyModel.csdl|res://MyDAL/Client.MyModel.ssdl|res://MyDAL/Client.MyModel.msl
I haven't encountered the metadata exception since I made this change.
share this blog :
Enable and disable the pen drive..
VS 2010 Keyboard Shortcut posters
Related Blogs
String Functions in ASP.NET
Difference between dotnet 3.5 and dotnet 4.0
Microsoft Web Farm Framework
Gridview control of Ext.NET
Basic facts and Tidbits in .NET Framework
All-In-One Code Framework
post comment
Fingers crossed :)
Posted by
Mahesh Chand
on
Feb 02, 2012
Fingers crossed :)
Posted by
Mahesh Chand
on
Feb 02, 2012
Sponsored by
Become a Sponsor
More Blogs from this Blogger
Metadata Exception in Entity Framework Connection Strings
View All
Latest Blogs
Free Ride is Over for Desktop Developers in Visual Studio 11
DotNet developers most used application/tools launching through 'Run'
80-inch Windows 8 Tablet
Data encapsulation
Option to access the Column Names in Data table
Open multiple windows in browser startup. (Multiple homepages option)
I'm Sorry
const and readonly
Address, Binding and Contract in WCF
JQuery Maxchars Plugin
View All
Sponsored by
Become a Sponsor