This project has moved and is read-only. For the latest updates, please go here.

UsingJsonSerializationOverWebApi while operating on data type byte[]

Sep 11, 2015 at 10:20 AM
while trying the sample, i have a Problem as follows,
if adding a new property with data type Byte[] into a model class, for example ProductCategory,
then a Sytem.Reflection.TargetInvocationException is thrown on runing, in this case the Demo class has been modified to test:
foreach (var i in repo.ProductCategories)
Console.WriteLine("  {0} | {1}", i.Id, i.Name);
but the test with Byte[] has no Problem with UsingXmlSerializationWebApi. the Exception seems it has nothing to do with Serialization, but Dynamic.
Thanks in advance.
Sep 14, 2015 at 10:00 PM
You're right! DynamicObjectMapper did not preserve array type but changed byte[]{1,2,3} into object[]{1,2,3} (as an example).

This led to something like the following:
long a = 0L;
object b = a;
byte c = (byte)b;
which throws a System.InvalidCastException

You can update to Remote.Linq 5.3.0-beta001 which in turn uses aqua-core 3.0.0-alpha002 that fixes the problem.

Please note namespaces Remote.Linq.Dynamic and Remote.Linq.TypeSystem changed to Aqua.Dynamic and Aqua.TypeSystem respectively.
Sep 15, 2015 at 9:00 AM
thanks for the reply.
after update of Remote.Linq i have tested the Demo "UsingJsonSerializationOverWebApi" again, which has as before a property of data type Byte[],
the data type is now correctly resolved, this is great!
a side effect occurs with the Remote.Linq update, i.e. the program becomes very slow. do i need to do something else in addition?
Sep 15, 2015 at 12:16 PM
I'm not yet aware of performance implications. Would it be possible to provide further information or sample code to reproduce and narrow down the issue?
Thanks in advance.
Sep 15, 2015 at 2:16 PM
the sample is the original "10_UsingJsonSerializationOverWebApi".
The program runs very fast with Remote.Linq 4.1.1;
and then i have updated Remote.Linq und used Remote.Linq Version 5.3.0-beta, as you recommended, but this time the program runs very slowly,
no matter whether a Byte[] property is added into the class ProductCategory.

Thanks for quick reply.
Sep 16, 2015 at 7:38 AM
Absolutely - thank you for reporting. I'll have to follow up...
Sep 16, 2015 at 7:41 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.