Dennis van der Stelt

The most votes generally drown out the best votes

Community

News

  • Meet me at PDC08

Email Notifications

I read...

I Use...

Tags

Recent Posts

Archives

Paste XML as serializable type

I had the privilege to see Steve Maine do some coding in a Microsoft SDR session after MIX07. While coding, he showed this cool tool that's in the BizTalk Services SDK. He was showing something he had build and copied a bit of XML into the clipboard and used this tool inside Visual Studio 2005 to paste it as a serializable type, converted from the blob of XML.

The tool just used the XML to create the new class. Easy as that, but really useful! It's in the menu under "Edit", and then "Paste XML as Serializable Type". I haven't stress tested it yet, as it's late when I'm writing this and I'm still very tired from missing so many hours of sleep during MIX07. Don't ask what I've spend them on; What happens in Vegas, stays in Vegas! ;-)

<training>

  <name>WCF</name>

  <location>MIC</location>

</training>

 Take the XML above and have a look at the class below.

[System.Xml.Serialization.XmlRootAttribute(Namespace = "", ElementName = "training")]

public class TrainingClass

{

  private string nameField;

  private string locationField;

 

  [System.Xml.Serialization.XmlElementAttribute(Namespace = "", ElementName = "name")]

  public virtual string Name

  {

    get { return this.nameField; }

    set  {  this.nameField = value;  }

  }

 

  [System.Xml.Serialization.XmlElementAttribute(Namespace = "", ElementName = "location")]

  public virtual string Location

  {

    get { return this.locationField;}

    set { this.locationField = value;}

  } 

}

It's located in the BizTalk Services SDK. Once installed, it's under C:\Program Files\BizTalk Services SDK\Samples\Web\Tooling\. Usable in both Visual Studio 2005 and "Orcas". Everyone immediately responded that they wanted the tool in a PowerTools package or something. It might be released that way, but until then download the SDK. And don't let the BizTalk name fool you, this tool and the services in the SDK are really useful. I hope to write about it a bit more.

Technorati tags: ,

Comments

Travis Laborde said:

Hi Dennis!  I'm very excited about this feature.  However, I'm unable to install IE7 and .NET 3.0 here yet...

Is there any way that you could grab just this addin and post or email me those bits?  Would it even work in plain vanilla VS2005?

As an aside, I'm doing a "tools" talk at our Philly.NET Code Camp tomorrow, and I'd *LOVE* to show off this thing :)

Thanks!

Travis

# May 18, 2007 5:33 AM

Dennis van der Stelt said:

Oh shit, totally forgot this one...

I have installed BizTalk Services on my laptop and I think they can be installed seperately. If you mail me, I'll send them.

bloggingabout.net/.../contact.aspx

# June 17, 2007 10:42 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)