none
How to fill or bypass a serialized Enum from a schema? RRS feed

  • Question

  • Hi all,

    Well, I converted a XSD file into a class in visual studio using the xsd.exe.

    The result is ok but the "clever" guys who did the XSD added a catalog of almost 80,000 rows, as a result I have a class that weights almost 20Mb, that is unacceptable.

    So I started to wonder if there is a way to fill that Enum from database when needed instead of having such a large file in memory all the time:

    <System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.33440"),  _
     System.SerializableAttribute(),  _
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.site.com/internet/cts/catalogs")>  _
    Public Enum c_PostalCodes
        xxx
    End Enum

    Any ideas?

    Thanks in advance


    G.Waters


    Wednesday, May 10, 2017 6:19 AM

All replies

  • Read my reply that I gave in your question as well. 

    Maybe does it not look so "sophisticated" to you, but you are now using a kind of clever hand brewed method around a special created XML definition.


    Success
    Cor


    Wednesday, May 10, 2017 8:27 AM
  • Read my reply that I gave in your question as well. 

    Maybe does it not look so "sophisticated" to you, but you are now using a kind of clever hand brewed method around a special created XML definition.


    Success
    Cor


    This does not answer my question

    G.Waters

    Wednesday, May 10, 2017 9:02 AM


  • This does not answer my question

    G.Waters

    What does, you have created your own "clever" solution for something which normally can be standard done, and now you want an answer for that "clever" solution.

    There is only one person who can solve that, despite what replies you mark as answer in future in this thread.


    Success
    Cor



    Wednesday, May 10, 2017 9:46 AM
  • The only way I know to create classes and enum are through CodeDOM.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, May 10, 2017 12:26 PM
    Moderator


  • This does not answer my question

    G.Waters

    What does, you have created your own "clever" solution for something which normally can be standard done, and now you want an answer for that "clever" solution.

    There is only one person who can solve that, despite what replies you mark as answer in future in this thread.


    Success
    Cor



    I didn't create the XSD file, so either you didn't read very well my post or you are enough rude

    G.Waters

    Wednesday, May 10, 2017 1:08 PM


  • I didn't create the XSD file, so either you didn't read very well my post or you are enough rude

    G.Waters

    No but the way you access (deserialized) that XSD is something you created yourself. An XSD is mostly a very difficult beast which contains very much more than only fields.

    The chance that those who created the XSD simply did use the DataSet Editor in Visual Studio or a likewise tool is very high. It is not a clever way, it is just simple. 

    But yes it is fine if you ask somebody do you think as well that my food is the best and somebody says yes. Than telling that this is the answer is often done. 


    Success
    Cor





    Wednesday, May 10, 2017 1:18 PM