I need to serialize a .NET table adapter. Serializing a data adapter and the data set is not a problem but i seem unable to serialize the table adapter. Looking at the type its typically specific to whatever you name it..like if i create a Invoice Table Adapter..the type will be InvoiceTableAdapter and its base type is component. This does not give me an easy type to work from like the sql data adapter which is relatively simple to serialize. Also, i need to be able to serialize it and deserialize it without having to include the dll it came from when i des开发者_开发百科erialize it. The only dlls available on when deserializing will be standard .NET dlls.
Also, i need to be able to serialize it and deserialize it without having to include the dll it came from when i deserialize it.
If you are using BinaryFormatter
(which I don't recommend, by the way), then no: you can't do that. That isn't how BinaryFormatter
works. It expects to recreate exactly what was serialized, which demands the same dlls.
If you are using any other serializer, it makes perhaps even less sense; you should be serializing *data, really. Not plumbing details like adapters.
In all seriousness, I think you need to reconsider your design here. Why are you trying to serialize adapters, for example? What would that even mean? It might, for example, make sense to write a DTO that represents the data you need to construct a vanilla SqlDataAdapter
.
精彩评论