Hi Team,
We are trying to migrate our on-premise SAAS applicaiton to windows azure, and we have used lot of Entity Framework for a module specifically. As a migration part we are trying to migrate and test the application in phases. We are using Azure appfabric
cache service as a session state provider.
When I try to configure the session state to appfabric cache we are running in to these issues related to Entity framework. First we got this error to fix this issue we have the class as [DataContract] and the issue is resolved.
System.Runtime.Serialization.InvalidDataContractException: Type 'XX.XX.XXX' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
If the type is a collection, consider marking it with the CollectionDataContractAttribute.
See the Microsoft .NET Framework documentation for other supported types.
The property 'AdXXXXXX' on type 'CaXXXXX_9FDDBE5B2C99F9C5DE2E0DCD2E8CC77D2CB59220D1A3413E91AF5A2B6A23026D' cannot be set because the collection is already set to an EntityCollection.
We are completely lost of how to fix these issues, and when googled a couple of threads tells we need to remove the virtual access modifier for the properties. But the same code works with out any issues like this on-premise, and the code is generated
automatically by the EF on each update of the model. We are also have other option of going to SQLAzure as session state provider in the second chance, but we are hoping there are also the same problems may exists as the data need to be serialized
when stored in the session.
http://social.msdn.microsoft.com/forums/en/adonetefx/thread/99d8d4a1-5ab1-42dc-b9db-5087be02162d
http://ianfnelson.com/archives/2011/03/09/entityframeworkadventure3/
The following link shows closely describes the same problem we are facing, and we are not using lazy loading as described in this post, but did not find the solution. see the last comments made by Rui in the below link
http://stackoverflow.com/questions/8980542/ef-dynamic-proxies-in-session-azure-cache
Thanks in advance.