0
votes

When Catel attempts to auto create an instance of the ViewModel class belonging to a view I get a SerializationException complaining that System.Data.Entity.DynamicProxies is not expected. The Model is an EF 6.1 Entity (inherits from ModelBase) and I am using Catel 3.9. How do I prevent this ?

1

1 Answers

0
votes

Note: this all applies to Catel 4.0 (latest prerelease versions, since that is stable and has much improvements).

Catel serializes the model for the purpose of the IEditableObject implementation. When using the Model attribute, it tries to serialize the members. You have 2 options:

  1. Use the [Model(SupportedIEditableObject = false)] (but you will lose the "automatic cancel" functionality
  2. Decorate the failing members with [ExcludeFromSerialization] or use a custom serializer modifier