Sandrino Di Mattia

Content-type: Microsoft

Social

Follow me on Twitter! LinkedIn! RSS! SilverlightShow Contributor

Recent posts

Tags

Categories

Archive

Blogroll

'System.NotSupportedException' and Entity Framework

I just finished refactoring parts of my DAL when my output window got filled with these:

But my application still ran fine, how weird is that.

First of all mscorlib.dll is one of the files that is tightly bound with the CLR.
So we know this is part of the .NET Framework.

And if we want more information about this NotSupportedException we can activate breaks for .NET Framework exceptions.
To do this open the Exceptions window and check the box for Common Language Runtime Exceptions:

 

Once this is done, re-run your application and you'll see the following:

This give as a 'little' more insight on the exception.
After doing some some research on 'The invoked member is not supported in a dynamic assembly.' it seems this is related to the connection line used to initialize your ObjectContext.

Let's say you have this in your configuration file:

metadata=res://*/MyEntities.csdl|res://*/MyEntities.ssdl|res://*/MyEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;Initial Catalog=Db;Integrated Security=True;MultipleActiveResultSets=True"

And let's say your ObjectContext (in our case MyEntities) is located in the assembly: Company.Application.Repositories.
Well, then you should replace the wildcard with the assembly name in the path of the resources.

Example:

metadata=res://Company.Application.Repositories/MyEntities.csdl|res://Company.Application.Repositories/MyEntities.ssdl|res://Company.Application.Repositories/MyEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;Initial Catalog=Db;Integrated Security=True;MultipleActiveResultSets=True"

This will do the trick!

Posted: Apr 09 2010, 15:25 by Sandrino | Comments (0) RSS comment feed |
Filed under: Development

Add comment




  Country flag
biuquote
Loading