Solved

How to work with xsd2Code generated business objects .NET ?

Posted on 2014-01-28
3
1,395 Views
Last Modified: 2014-01-31
Hello EE!

Having a trouble to figure out how to call methods of xsd2Code generated business objects .NET application.

Say for instance I have generated with xsd2Code with a

Namespace CustomersOrders

 ...
    Partial Public Class Root 
....

Open in new window


As it stated I have to call Root.Serialize()
to generate test XML.

in VB.NET it's just not working as well I can access only  Deserialize()  and ReadFromFile
but nothing else.

Where to begin to work with generated classes and how to pass a values to those classes during serialization?

Thank you.

Alex
CustomersOrders.xml
CustomersOrders.xsd
CustomersOrders.Designer.vb
0
Comment
Question by:astronm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39814951
Looking at the designer class, there is a serialize method but it appears to be dummy and is expected to be overriden by your code.
0
 

Author Comment

by:astronm
ID: 39815164
Hi Savant.
Oh, You right! it turns like need some constructions like
Public Overrides Function  Serialize() As String 

Open in new window


But how to build this Overrides Function for every element in generated classes ?

Can I just replace it in a classes declarations with same construction as Deserialize have :
 Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As Root, ByRef exception As System.Exception) As Boolean

Open in new window


In other words, what the use of those overridden functions if they are build in every separate Partial Public Class  like Root or CustomerType or AddressType ...

May be you have some very simple example how to use them for serialization?

Thank you.

Alex
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39815494
You implement it in each class so that you can serialize each class independently. You choose the way you want to serialize it. For example, you can serialize it to XML, JSON or plain text.

Here is an example which uses builtin XMLSerializer

http://www.vb-helper.com/howto_net_serialize.html
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question