Solved

How to work with xsd2Code generated business objects .NET ?

Posted on 2014-01-28
3
1,287 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now