Otis wrote:
Max wrote:
Otis wrote:
Predicates only serialize using binary/soap formatters, so I'd go for the memorystream approach with base64 encoding afterwards.
Ok, but the question is:
What of the following type of changes can break the deserialization?
*) Change to the fields used in predicate?
*) Change to the fields NOT used in predicate (but that belong to an entity of which some other fields are used in predicate)?
*) Order change of the fields/columns (used in predicate) in entity/tables?
*) Change in the predicate object structure?
*) Other LLBLGen runtime library update?
*) Anything others?
Thanks, Max
Runtime lib updates could in theory break it. It's in general not recommended to store the predicates as used in an application in the database because as you suggest, they're not changing when the rest might change, like field updates, code updates etc.
Why exactly do you want to do this?
It’s a long story
I'm developing a part of the reporting framework of our new project.
The part I'm working on is about printing "big" information. Like one printed page for each entity.
For example a birth certification, a customer data (with address, phones, billing data ecc...)
It's the type of print that you can do using MS Word + some datasource.
You have some dynamic data, and much fix formatted text.
Our printing framework, for that type of print, is based on RTF.
We define an RTF that contain the fix/formatted text.
Obviously we need to put some data inside that RTF.
So we have developed a "Tag" printing framework.
I can have a StringTag:
[CustomersEntity.PhoneEntity.PhoneNumber]
These represent the Tag in RTF.
When I load the RTF I search for Tag, instantiate the Tag, and substitute the TagTex with the RenderedText.
So the Tag needs to start from a structured data source (entity+SubEntity) and give out a formatted string representing the data value.
After the rendering I will do Rtf.Replace (TagText, TagRenderedText)
Now, if PhoneEntity is a collection, I need to identify a single phone, so I need a filter.
I've implemented the management of FieldCompareValue filter.
This: "CustomersEntity.PhoneEntity " represent a DataPath
This: "CustomersEntity.PhoneEntity (PhoneType = Fax)" represent a DataPath with filter
This: "PhoneType = Fax" is the text that represent an LLBLGen FieldCompareValuePredicate
Now, I can write my own code to serialize/desreialize Predicate to/From string in my RtfTag DataPath. But seem to do a job already done, because I can Serialize a Predicate using a .Net Binary Serializer.
I know that my code is based on String, so if PhoneEntity has a field named PhoneType , my serialization/deserialization will not broke.
Even if Predicate constructor doesn’t change, my serialization/deserialization will not broke.
But if I use .Net serialization, ad if this rely on FieldEnum/Field order: if I add a new field before PhoneType, the .Net deserialization will broke, and this is not good...
So I was trying to understand where are the maximum admissible change that will not broke .Net serialization.
So I can decide if I need to rewrite my own serialization/deserialization for all IPredicate class, or if I can rely on .net Serialization/Deserialization.
Thanks, Max