Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to work with xsd2Code generated business objects .NET ?

Posted on 2014-01-28
3
Medium Priority
?
1,471 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

971 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