vb.net - serializing type definitions? -
i'm not positive i'm going right way. i've got suite of applications have varying types of output (custom defined types).
for example, might have type called widget:
class widget public name string end class
throughout course of operation, when user experiences condition, application take output instance of widget user received, serialize it, , log database noting name of type.
now, have other applications similar, instead of dealing widget, totally random other type different attributes, again serialize instance, log db, , note name of type. have maybe half dozen different types , don't anticipate many additional ones in future.
after said , done, have admin interface looks through these logs, , has ability user view contents of data thats been logged. admin app has reference types involved, , basic switch case logic hinged upon name of type, cast original types, , pass on handlers have basic display logic spit data out in readable format (one display handler each type)
now... , good...
until 1 day, model changed. widget class has deprecated name attribute , added on bunch of other attributes. of course type mismatches in admin side when try reconstitute data.
i wondering if there way, @ runtime, perhaps reflect through code , snapshot of type definition @ precise moment, serialize it, , store along data somehow use reconstitute in future?
i haven't needed since in mfc days quite manual process, work differently in .net, maybe can useful anyway. way solved when serialized wrote version number , added new bits of data write, never removed or amended (though we'd output empty data, if example name removed, we'd write empty string).
then deserializer use lot of if statements read parts of data if on version x, , when had read in mentioned in deserializer, ignored after that.
the big advantage doing way data read both older , newer versions of app, though work if app use suitable defaults missing data, shouldn't problem if want @ data in admin tool, , give advantage it's less urgent update admin tool every time make change models.
Comments
Post a Comment