DevScope Integration Toolkit: Schema to C# for Visual Studio Code

  • Sandro Pereira
  • Dec 2, 2026
  • 7 min read

As integration developers, we spend a lot of time working with schemas. For example, those schemas sometimes describe XML messages:

  • Orders
  • Invoices
  • Customers
  • Shipments
  • EDI canonical models
  • Internal enterprise messages

However, when working with APIs and modern applications, those contracts are often defined using JSON Schema.

Regardless of the format, sooner or later, we reach exactly the same requirement:

I have the schema. Now I need C# classes representing it.

For example, we may be building an Azure Function. Alternatively, we may need a custom integration component. In other cases, we may be creating an API, an automated test, or a helper library. Sometimes, we simply need code that can serialize and deserialize those messages.

Nevertheless, whatever the scenario, one thing has always annoyed me:

  • After all, the schema already describes the message. Therefore, why should I describe the same message again manually in C#?

For this reason, this is another developer experience we wanted to simplify with the DevScope Integration Toolkit.

So, meet Schema to C#.

πŸ“ One-Minute Brief

Integration developers frequently need C# models matching existing XML or JSON message contracts. DevScope Integration Toolkit: Schema to C# converts XSD and JSON Schema definitions directly into C# classes inside Visual Studio Code, reducing repetitive manual work and helping developers quickly turn integration contracts into code-ready models.

Schemas are contracts

In enterprise integration, schemas play an important role because they describe the structure of the messages being exchanged between systems.

For example, an XSD Schema can define things such as:

  • Elements;
  • Attributes;
  • Complex types;
  • Simple types;
  • Data types;
  • Cardinality;
  • Optional elements;
  • Repeating structures;
  • Nested objects;
  • Namespaces.

Similarly, JSON Schema provides similar capabilities for JSON documents.

For example, we might have a JSON Schema describing an order containing:

Order
β”œβ”€β”€ OrderNumber
β”œβ”€β”€ OrderDate
β”œβ”€β”€ Customer
β”‚   β”œβ”€β”€ Id
β”‚   β”œβ”€β”€ Name
β”‚   └── Email
└── Lines
    └── Line[]
        β”œβ”€β”€ Product
        β”œβ”€β”€ Quantity
        └── Price

The contract already exists. It already tells us what an Order looks like. Then we start writing an Azure Function or another .NET component, and suddenly we need to create:

public class Order
{
    public string OrderNumber { get; set; }

    public DateTime OrderDate { get; set; }

    public Customer Customer { get; set; }

    public List<Line> Lines { get; set; }
}

Then:

public class Customer
{
    public string Id { get; set; }

    public string Name { get; set; }

    public string Email { get; set; }
}

And:

public class Line
{
    public string Product { get; set; }

    public int Quantity { get; set; }

    public decimal Price { get; set; }
}

There is nothing particularly difficult about doing this. But why are we doing it manually?

From XSD Schema to C#

Let’s start with XML.

Imagine that we already have an XSD Schema similar to this:

&lt;?xml version="1.0" encoding="utf-8"?>
&lt;xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://schemas.devscope.net/orders"
    elementFormDefault="qualified">

    &lt;xs:element name="Order">
        &lt;xs:complexType>
            &lt;xs:sequence>

                &lt;xs:element
                    name="OrderNumber"
                    type="xs:string" />

                &lt;xs:element
                    name="OrderDate"
                    type="xs:dateTime" />

                &lt;xs:element name="Customer">
                    &lt;xs:complexType>
                        &lt;xs:sequence>

                            &lt;xs:element
                                name="Id"
                                type="xs:string" />

                            &lt;xs:element
                                name="Name"
                                type="xs:string" />

                        &lt;/xs:sequence>
                    &lt;/xs:complexType>
                &lt;/xs:element>

            &lt;/xs:sequence>
        &lt;/xs:complexType>
    &lt;/xs:element>

&lt;/xs:schema>

Looking at the XSD, we can easily understand the basic structure:

Order
β”œβ”€β”€ OrderNumber
β”œβ”€β”€ OrderDate
└── Customer
    β”œβ”€β”€ Id
    └── Name

Now let’s say we need to process this message inside some C# code.

Conceptually, we need something similar to:

public class Order
{
    public string OrderNumber { get; set; }

    public DateTime OrderDate { get; set; }

    public Customer Customer { get; set; }
}

public class Customer
{
    public string Id { get; set; }

    public string Name { get; set; }
}

Of course, we can write those classes manually. For a schema this small, it doesn’t take long. Now imagine an enterprise schema containing:

  • 50 elements;
  • Several nested complex types;
  • Multiple repeating records;
  • Different data types;
  • Hundreds of fields.
  • Different namespaces.
  • Multiple schemas (import or include)

Suddenly, manually translating the schema into C# isn’t quite so appealing. And more importantly, it isn’t adding much value. We’re basically translating information from one representation into another.

That is precisely the kind of repetitive work tooling should do for us.

Introducing Schema to C#

That is the idea behind Schema to C# in the DevScope Integration Toolkit.

The workflow is deliberately straightforward:

  1. Provide the schema.
  2. Let the tool analyze the structure.
  3. Generate the corresponding C# classes.
  4. Use those classes in your .NET solution.
XSD Schema to C#

Instead of manually reproducing the contract, we let the schema drive the model generation.

In simple terms:

XSD Schema
     ↓
 Schema to C#
     ↓
 C# Classes

Within Visual Studio, we had a command-line tool to perform these tasks: xsd AnotherOutput.xsd /classes /language:CS

But XSD isn’t the only schema format we work with today.

From JSON Schema to C#

Modern integration solutions also use JSON extensively.

REST APIs, SaaS applications, Azure Functions, messaging solutions, and many other platforms commonly exchange JSON payloads.

And when the structure of those messages is formally defined, we may have a JSON Schema.

Imagine a simplified schema:

{
  "type": "object",
  "properties": {
    "orderNumber": {
      "type": "string"
    },
    "orderDate": {
      "type": "string",
      "format": "date-time"
    },
    "customer": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    }
  }
}

Again, the contract already tells us a lot:

  • We know that we have an order.
  • We know that it contains an order number.
  • We know that it contains a date.
  • And we know that customer is another object containing id and name.

Why manually translate all that into C#? With Schema to C#, the same concept applies:

JSON Schema
      ↓
  Schema to C#
      ↓
  C# Classes
JSON Schema to C#

The source format is different. The developer requirement is exactly the same.

In this case, we can also choose one of the following serializers:

  • Newtonsoft.Json
  • or System.Text.Json

and other configurations like:

  • The namespace.
  • The Root class name.
  • and serialization configurations.
serialization configurations

Very useful when building Azure Functions or Local Functions

One scenario where I see this being particularly useful is Azure Functions or Logic Apps Local Functions.

Logic Apps can handle an enormous amount of integration logic without requiring custom code. But there are always scenarios where an Azure Function makes sense, or we need to call a Logic Apps Local Function to bypass a limitation or to simplify the workflow logic.

Perhaps we need:

  • Complex business logic;
  • Custom validation;
  • A specialized transformation;
  • A library that already exists in .NET;
  • Processing that is difficult to implement directly in the workflow.

Imagine the Logic App sends an Order to an Azure Function. We already have the schema describing that Order.

Now the function needs to deserialize the incoming payload into an Order model. Instead of spending time manually creating the entire object model, we can generate it from the schema.

That gives us a much faster starting point for the code that actually matters.

Of course, this functionality isn’t limited to Azure Functions. There are many integration development scenarios where generating C# classes from a schema can be useful.

Stop manually recreating contracts

Of course, generating C# classes isn’t something nobody has ever done before. There are other tools and techniques for generating code from schemas.

That isn’t really the point.

The goal of the DevScope Integration Toolkit is to bring useful integration development capabilities together where we’re already working:

  • Visual Studio Code.

If I’m editing my XSD inside VS Code and suddenly need C# classes, I shouldn’t need to leave my development environment and start looking for another tool. The same applies to JSON Schema.

The workflow should be simple:

  • Schema β†’ Generate β†’ Code

Not:

  • Schema β†’ search the web or external tool β†’ find a converter β†’ upload/copy schema β†’ configure converter β†’ generate code β†’ copy it back β†’ continue developing

That context switching is exactly the kind of small friction that becomes annoying when repeated every day.

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars LEGO set for my son.

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book β€œBizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top