custom serialization of root level items

Mar 1, 2011 at 8:50 PM

Is there a way to do custom serialization of root level items?

Here is what I did, and what I expected:

I registered a Serializer:

_engine.SterlingDatabase.RegisterSerializer<MyObjectSerializer>();

Then when I did a save of MyObject (see below), I expected it to use the above registered serializer, but it didn't ***.

MyObject myObject = new MyObject() { XYZ = "1", XYZ2 = "2"};
SterlingService.Current.Database.Save(myObject);

Am I doing something wrong? Or are my expectations incorrect? Or is this a bug/feature?

Thanks,

Microants

*** Yes I have a correctly written serializer. If I put it as a collection of MyObjects of another class it calls it correctly.

Coordinator
Mar 2, 2011 at 3:33 PM

This is intended. Anything defined as a table has to be something that Sterling can navigate, otherwise it wouldn't be able to handle the parsing of foreign entities/keys correctly. The custom serializer is more intended for either special objects that are part of those classes that you want to override, or for objects that have parametered constructors you are able to provide parameters for.