Solved

How to work with xsd2Code generated business objects .NET ?

Posted on 2014-01-28
3
1,317 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 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