Skip to main content

Microsoft Silverlight

Unanswered Question ADO.Net Data Services generated proxy doesn't compileRSS Feed

(0)

omnius
omnius

Member

Member

24 points

9 Posts

ADO.Net Data Services generated proxy doesn't compile

I believe I may have stumbled across a bug, I am just not sure which piece of the chain contains the bug. I do not yet have a striped down example that shows the bug, but I will try to create one if needed.

 My problem is that the proxy class generated for my service using DataSvcUtil.exe contains some [global::System.Serializable()] attributes decorating several classes. Since Silverlight does not support that attribute, I get errors during compilation due to the System namespace not containing a SerializableAttribute type which I believe is correct.

 With some further investigation, it looks like the only classes that DataSvcUtil.exe decorates with the Serializable attribute are classes that map to ComplexTypes in my EDMX file. I know that the Entity Data Model Designer does not support ComplexTypes, but I was under the impression that the underlying framework did and they were safe to use as long as you were willing to do without the designer. I do not remember reading anywhere that the Silverlight client would not support services that used ComplexTypes either.

 Is this not supported, or is it just a bug somewhere. Perhaps the DataSvcUtil.exe adding the Serializable attribute when it shouldn't be? As a side note, I used the same generated proxy in a WPF application and everything worked perfectly fine.
 

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25052 points

2,747 Posts

Re: ADO.Net Data Services generated proxy doesn't compile

Hello, I can't reproduce this issue. But maybe it's because my data service is too simple... Can you post some code? Also, please make sure you're using the latest ADO.NET Data Service with the latest Entity Framework (in .NET 3.5 SP1). If you're using an earlier version, such as Entity Framework CTP 3, or Data Service that in ASP.NET Extensions Preview, you may encounter problems.

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

omnius
omnius

Member

Member

24 points

9 Posts

Re: ADO.Net Data Services generated proxy doesn't compile

 I will see if I can create a stripped down solution that shows the error.

Omnius
Omnius

Member

Member

24 points

9 Posts

Re: ADO.Net Data Services generated proxy doesn't compile

I have created an entire solution with a very basic data model that exhibits the issue. You can download it here: http://test.accuauto.net/SilverlightDataServicesTest.zip

There is only one table in the database named Client, but it has two sets of address related columns.  Street address and mail address.  In the EDMX file I created an Address complex type and mapped the individual address fields in the storage model to the StreetAddress and MailAddress fields on the Client entity in the conceptual model. At this point it stops compiling because the designer does not support the complex type I just added. Near the end of the EDMX file I changed the ValidateOnBuild setting to false so that the designer wouldn't complain and let it compile.

"<DesignerProperty Name="ValidateOnBuild" Value="false" />" 

 I created an ADO.Net Data Service that uses the ObjectContext and then added a seperate Silverlight project. That is the basic setup and at this point everything compiles fine. The next step is to open the VS2008 command prompt and use DataSvcUtil to generate the proxy for the data service. I generated one and added it to the Silverlight project and then it no longer compiles due to the following two errors.

Error    1    The type or namespace name 'SerializableAttribute' does not exist in the namespace 'System' (are you missing an assembly reference?)

Error    2    The type or namespace name 'Serializable' does not exist in the namespace 'System' (are you missing an assembly reference?)


The line those errors point to in the generated proxy file are "[global::System.Serializable()]"  

omnius
omnius

Member

Member

24 points

9 Posts

Re: ADO.Net Data Services generated proxy doesn't compile

 Did I ask this in the correct forum? Should I provide the example code differently? I would like to verify if there is a problem or not to make sure I'm not just doing something wrong.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities