Search code examples
c#.netreflectionserializationassemblies

Assembly Serialization, Why?


I've read that assembly serialization (sgen.exe) can improve performance. What exactly is providing the improvement? Is it metadata on the Types? I would have thought this would be available through reflection! so why is it required in a separate assembly?


Solution

  • The serialization assemblies Data.XmlSerializers.dll which improve the performance of clients that use XML Web service proxies to communicate with servers is described under http://msdn.microsoft.com/en-us/library/bk3w6240.aspx.

    If you don't do this the same work will be done at the first usage of XmlSerializer. In the blog Link is described additional setting in <system.diagnostics> area of the application.config file to see more what do XmlSerializer in the background.

    In Visual Studio there are a spetion setting in the "Build" tab of project settings (see http://www.eggheadcafe.com/tutorials/aspnet/8eb0e68f-5496-4363-9cb9-dd68447ba187/xml-serializer-generator.aspx). So you not really need to use sgen.exe manually.

    To more understand what sgen.exe do you can load an open source version of sgen.exe: xgenplus http://xgenplus.codeplex.com/.

    I recommend you aslo to read SGEN XMLSerializer - should be .XMLSerializers.dll added as a reference to the current project or to the GAC?.

    If you search in google for XmlSerializer and sgen you will find all the information and even more on the first page of the serch results.