Use registred CustomSerializer for Criteria-Objects#4866
Conversation
…ated `DataPortalProxy` to use `IDataPortal<PrimitiveCriteria>` for criteria creation.
StefanOssendorf
left a comment
There was a problem hiding this comment.
Hi. Thank you for your contribution.
However I think this is the wrong approach to solve this issue. The PrimitiveCriteria was meant to deal with the .net primitives (int, string, DateTime, ...) and not with custom serializers.
I think the correct way would be something like adding a way to ISerializationFormatter to ask if it can check a particular type.
If yes: Skip PrimitiveCriteria
If no: Use PrimitiveCriteria
But this is something more fundamental where I'd like to get @rockfordlhotka opinion this. Your way works, maybe as a temporary implementation, but it should be implemented in another way for the future.
|
Looking at the changes, this might be the simplest overall solution. There's no real downside (I don't think) to having it subclass The drawback is that we're now involving DI to create instances of something that used to be cheap and trivial, but it is probably not going to be a noticeable perf issue. On the other hand, what @StefanOssendorf says could be valid - other serializers (like the super-fast one from @JasonBock) could, in theory, support serialization of types in ways different from MobileFormatter - with support for different types entirely. For example, I don't think Jason's serializer relies on |
|
The only thing my serializer does with Also, my SG allows a user to register custom serialization implementations for types if needed. |
|
Even with @JasonBock's serializer, serializing Criteria objects still doesn't work, even after registering a CustomSerializer for it. I suspect the fallback to |
|
@jensbrand probably because I don't support |
|
@jensbrand BTW can you submit a bug report to my serializer with your |
Done |
Summary
IMobileObjectbypass registered custom serializers, causing serialization errors.PrimitiveCriteriainto aReadOnlyBaseand updatedDataPortalProxyto instantiate it via the data portal.Related Issue
Fixes #4865 (Custom Serializer for Criteria-Objects)