Profil de Denzil PintoTheBuzzPhotosBlogListes Outils Aide

Blog


1 mai

Generate Schema from Class Library

 

We need to first create a new solution in visual studio.net, follow the steps below

  •  Open Visual Studio.Net and then select File > New > Project > Class Library from Visual C# Projects.
  • Enter a New Name “ClassLibraryEmployeeTest”. 
  •  Right Click on the Project File and select Add > Add New Item > Select Class from the templates and Enter a New Name “Employee”
  • Double Click on EmployeeData and paste in the following Code

 

using System;

using System.Xml.Serialization;

 

namespace ClassLibraryEmployeeTest

{

   [Serializable()]

   [XmlRoot]

  

   public class Employee

   {

               [XmlElement("EmployeeID",typeof(int))]

               public int empID;

               [XmlElement("EmployeeName",typeof(string))]

               public string empName;

               [XmlElement("Address", typeof(Address))]

               public Address address;

 

               [System.Xml.Serialization.XmlIgnore]

               public int EMPID

               {

                           get

                           {

                                       return empID;

                           }

 

                           set

                           {

                                       empID=value;

                           }

               }

   [System.Xml.Serialization.XmlIgnore]

               public string EMPName

               {

                           get

                           {

                                       return empName;

                           }

                           set

                           {

                                       empName=value;

                           }

               }

              

              

               public Employee()

               {

                          

               }

   }

}

 

 

·        If you look at the code carefully you will notice that we have three fields, empID, empName and Address. Now we need to add Address so again

·        Right click on the Project File and select Add > Add New Item > select Class from the templates and enter the name “Address”.

·        Open Address and add the following code 

 

using System;

using System.Xml.Serialization;

 

namespace ClassLibraryEmployeeTest

{

              

   public class Address

   {

               [System.Xml.Serialization.XmlIgnore]

               public string address1;

              

               public string phoneNo;

               [System.Xml.Serialization.XmlIgnore]

 

               public string Address1

               {

                           get

                           {

                                       return address1;

                           }

                           set

                           {

                                       address1=value;

                           }

               }

               [System.Xml.Serialization.XmlIgnore]

               public string PhoneNo

               {

                           get

                           {

                                       return phoneNo;

                           }

                           set

                           {

                                       phoneNo=value;

                           }

               }

 

               public Address()

               {

                          

 

               }

   }

}

 

 

  •  So now build your solution file.
  • Open the Visual Studio command prompt. Click on Start > All Programs > Microsoft Visual Studio.Net 2003 > Visual Studio .Net Tools > Visual Studio.Net 2003 command prompt
  •  At the command prompt type in the following xsd <path to your solution file\bin\debug\ClassLibraryEmployeeTest.dll> /type:Employee  /o:<path to where you want to put the new schema file for instance c:\EmployeeTest\>
  •  If you have trouble getting your solution path click on the Solution file in the Solution explorer and in the properties window you will find the Path.
  •  At the command prompt you will notice “Writing file c:\employeetest\schema0.xsd. By default the schema is named schema0.xsd.
  • Now open a new BizTalk Solution. Select File > New BizTalk Projects > Empty BizTalk Server Project. Type in a new Name like BizTalkSchemaTest
  •  Once opened Right click on your Project File and select Add > Add Existing Item > <navigate to the directory where you have schema0.xsd for example c:\employeetest\>Select Schema0.xsd and click on Open.

 

You have now added the new schema to BizTalk.

 

Commentaires

Veuillez patienter...
Le commentaire entré est trop long. Raccourcissez-le.
Vous n'avez rien entré. Réessayez.
Il est actuellement impossible d'ajouter votre commentaire. Réessayez plus tard.
Pour ajouter un commentaire, tu dois avoir l'autorisation de tes parents. Demander l'autorisation
Tes parents ont désactivé les commentaires.
Il est actuellement impossible de supprimer votre commentaire. Réessayez plus tard.
Vous avez dépassé le nombre maximal de commentaires qu'il est possible d'envoyer le même jour. Réessayez dans 24 heures.
Votre compte a pu laisser les commentaires désactivés parce que nos systèmes indiquent que vous risquez d'arroser d'autres utilisateurs de messages. Si vous pensez que votre compte a été désactivé par erreur, contactez l'assistance en ligne de Windows Live.
Effectuez la vérification de sécurité ci-dessous pour finaliser l'envoi de votre commentaire.
Les caractères entrés pour la vérification de sécurité doivent correspondre à ceux de l'image ou du fichier audio.

Pour ajouter un commentaire, connectez-vous avec votre identifiant Windows Live ID (si vous utilisez Messenger ou Xbox LIVE, vous avez un identifiant Windows Live ID). Connectez-vous


Vous n'avez pas d'identifiant Windows Live ID ? Inscrivez-vous

Rétroliens

L'URL de rétrolien de ce billet est :
http://denzilpinto.spaces.live.com/blog/cns!A2256C53CD2EC18E!149.trak
Blogs Web qui font référence à ce billet
  • Aucune