ExtendedXmlSerializer / home

A configurable and eXtensible Xml serializer for .NET.

Home Page:https://extendedxmlserializer.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: how to best handle types moving from one assembly to another?

wexman opened this issue · comments

I want to move a type from one assembly to another for reasons. So objects were serialized when the type was in the old assembly and are to be found in the new assembly on deserialization.
Is that doable somehow? And if so, how?

Hi @wexman thanks for writing in with your question. As you are probably aware we do have our migrations extension, but I do not think this will help in your scenario (I could be wrong, @WojciechNagorski?).

In your situation, I would recommend using XSLT to run the documents through a transformation document that would update the namespaces so they point to the new location(s). You should then be able to load the document into ExtendedXmlSerializer with the new namespaces and continue from there (in theory 😁).

Please let me know if you have any further questions around this and I will do my best to assist you. 👍

Actually, I was NOT aware of the migrations extension, so thanks for pointing me to that. Looks interesting, but does indeed not seem to be helpful in my special case.

Regarding the XSLT approach: I was hoping to avoid such a solution, but that would of course be a possibility.

Yeah the migrations is a v1 feature and as far as I understand it's for types that have had their schemas change. In this case (if I understand correctly), the schemas are the same they just need to have the namespaces updated.

Actually, now thinking about it, you might be able to use the migrations extension to do a search for the xmlns="<namespace>" (and/or xmlns:<prefix>="<namespace>") attribute and emit a new one instead. You would be traversing uncharted territory, however. 😁 I would be interested in hearing if you have any luck with it, though.

Going through older issues here... looks like this one has been addressed/answered. Please do let me know if you have any further questions around this issue by leaving a comment and we can discuss further. Closing for now.