Skip to main content

Latest Posts:

Silverlight 2.0 Beta 2 plus ADO .net Entity Framework not working yet
Entry Date: Aug 2008 keywords: WCF; ADO .net; Silverlight; VS 2008; Visual Studio 2008; XAML;
Short Description:

Visual Studio SP-1 has been released and one of the major updates of this Service Pack is the RTM of the ADO .net Entity Framework. Does this integrate well with the current Beta 2 version of Silverlight + WCF ? ... in theory yes, but in practice...


Visual Studio SP-1 has been released and one of the major updates of this Service Pack is the RTM of the ADO .net Entity Framework.

In the July issue of the MSDN Magazine there was a very interesting article by John Papa: The Entity Framework In Layered Architectures there you will find how to build up a cutting edge architecture using:

  • --> Front End / UI: WPF (Windows Presentation Foundation).

  • --> Service Layer: WCF (Windows Communication Foundation).

  • --> DAL / Data Access Layer: ADO .net Entity Framework.

Most of the geeks that have read this article (including myself), thought: WOW !! For sure this can be ported to Silverlight, instead of wondering why… the samples haven’t been built for Silverlight ?.

The thing is… you start building your solution: no problem with the UI layer, no problem exposing WCF services and consuming them from Silverlight Beta 2, but now the problem comes serializing ADO .net entities, Why is so important this entity serialization?:

  • --> One of the powerful things of ADO .net entity framework is that entity objects can be serialized.

  • --> This means that they can be passed between layers, even via web services.

  • --> It saves a lot of useful information.

  • --> Let’s you forget about having custom made entity classes.

You realize that things are not working when you add the service reference to your silverlight project and try to compile, you get the following error message:

'System.Runtime.Serialization.DataContractAttribute' does not contain a definition for 'IsReference'

In the proxy autogenerated code:


If you start googling you find some threads that will get a chimp busy for a day… uninstall all for visual studio stuff, extensions, service pack, … and try again

What does Ms Chaps say about this ?

Comment 1:

The mismatch of the Client library and the Server dll is fixed in later releases of the Silverlight SDK. You will be able to use the EF generated types in your SIlverlight application in the near future . Unfortunately , I can't give you a date of when the next Silverlight SDK is gonna be released , but rest assured , this scenario WILL work when the next Silverligtht SDK ships

Comment 2:

Hi, as discussed earlier, support for IsReference will be added in RTW.

Is there a Workaround?

Your code will compile if you remove from the autogenerated code the IsReference=True, but you will then face inconsistencies in the serialized objects coming back intact.

So… it seems that we will have to wait for the RTW version.

My opinion: is normal that a Beta version contains bugs, it’s normal that the Ms Development team cannot focus on preparing hot fixes, they must keep their minds on the next iteration, BUT they should have a daily updated page including well known errors and possible workarounds or when is expected to have a fix for that bug, it’s quite disgusting to find the error, read some unofficial thread, fully reinstall Visual Studio and later find that.. uh ! it was a bug…

More information:

Ms ADO .net Entity Framework forum (Patrick Magee MSFT)

Silverlight forum (Yin-Lun Luo MSFT)

Page (1) Of 1