Format.Native with Sql Server 2005
One of the things that I have learned (the hard way) when dealing with a user defined aggregate is that your code should use Format.Native as the native serialization format. The will result in your data being formatted with the native Sql Server binary serialization. There a couple of problems with this format.
- Lack of flexibility. All public properties must be fixed length value properties. Strings will not work.
- The structure layout for your strucutre must be set to Sequential like this: StructLayout(LayoutKind.Sequential). BTW, you then need to include/import the System.Runtime.InteropServices namespace.
Format.Native is the fastest serialization format, but also the most limiting. What are your other options?
- SerializedWithMetaData. You probably want to stay away from this format as Microsoft has already marked this as going away.
- Structured.
- Unknown.
- UserDefined.