We have an application that uses XmlSerialization to facilitate having
Sql server return large object graphs with just a single stored
procedure call. It works very nicely except for 1 small problem.
Given the *large* number of objects that we're dealing with, all those
pesky "new XmlSerializer(..." calls are really taking some time. We
currently cache the returned serializers, so subsequent reads are
quite reasonable. But, when first reading from the database, it takes
quite a while.
What I'd like to do is have another chunk of code that creates
serializers for all the relevant classes, and somehow stores the
generated assembly so that it can be loaded at runtime from the main
app. (I'm not worried about these getting out of sync with the
objects, I can solve that problem). Then, I'd wrap the whole can of
worms with a nice simple call to something like...
XmlSerializer GetSerializer( Type type );
So, how can I store the generated XmlSerializers and reference them
later?
If I can't do that, do you have any performance suggestions?
I'm really not looking forward to redesigning the data layer!