linq to sql and wcf/ wired problem
-
Sunday, September 16, 2012 7:19 AM
hi,
i posted this question in the silverlight website, and they refer me here
i have two questions:
1)how can i turn aclass which was auto generated by the linq to sql into a DataContract?
and
2) why if i return a list of items from my wcf, i get an ObservableCollection instead on the client?
thanks in advance
jony
- Edited by jony feldman Sunday, September 16, 2012 7:20 AM
All Replies
-
Wednesday, September 19, 2012 6:10 AMModerator
Hi,
>1)how can i turn aclass which was auto generated by the linq to sql into a DataContract?
As far as I know, there is no way to do it.
You should do it via yourself because linq to sql is not designed for wcf .
>2) why if i return a list of items from my wcf, i get an ObservableCollection instead on the client?
For ObservableCollection , please refer to the images below:
Hope helpful.
- Marked As Answer by jony feldman Wednesday, September 19, 2012 10:20 AM
-
Wednesday, September 19, 2012 6:24 AMModerator
More images.
My interface is :List<Company> GetAppointmentJson(int companyId, int appointmentDate);
The client side is :
Hope helpful.
- Edited by Otomii LuModerator Wednesday, September 19, 2012 6:24 AM
-
Wednesday, September 19, 2012 10:21 AM
i did found an anwer to the first question here is the way to do it:
Response to the original question that started this thread:
You can specify that you want DataContract/DataMember attributes in designer or SqlMetal.
In designer, just right click on the design surface and specify "Unidirectional" in property grid for "Serialization Mode".
For SqlMetal, the /serialization:Unidirectional does the same trick.
Unidirectional indicates that id/idrefs are _not_ used. Currently we do not support bidirectional setting which would require id/idrefs to handle cycles.
Thanks,
Dinesh
- Marked As Answer by jony feldman Wednesday, September 19, 2012 10:21 AM

