Skip to the content.

Be.Stateless.BizTalk.Schemas

Build Pipelines

Latest Release

Release Preview

Overview

Be.Stateless.BizTalk.Schemas is part of the BizTalk.Factory Application Package. This component provides BizTalk.Factory’s document and property schemas for general purpose Microsoft BizTalk Server® development.

XML Schemas

Be.Stateless.BizTalk.Schemas comes with 2 generic XML schemas:

Property Schemas

Be.Stateless.BizTalk.Schemas comes with 1 property schema, BizTalkFactoryProperties.xsd, whose type’s full name is Be.Stateless.BizTalk.Schemas.BizTalkFactory.Properties, and which defines 3 properties that can be used in message routing scenarios, i.e. publication/subscription filters:

Context Properties

Following the BizTalk.Factory design principles, Be.Stateless.BizTalk.ContextProperties.Subscribable.BizTalkFactoryProperties provides the accelerators for the context properties that belong to BizTalk.Factory and can be used in subscription filters. These are not to be confused with Be.Stateless.BizTalk.ContextProperties.BizTalkFactoryProperties, which provides the accelerators for the context properties that cannot be used in subscription filters.

See Message Context API and MessageContextProperty<T, TR> Abstraction for background information about these accelerators.

Fluent API

Be.Stateless.BizTalk.Schemas also provides a fluent API, thanks to extension methods defined by Be.Stateless.BizTalk.ContextProperties.Extensions.BizTalkFactorySubscribablePropertiesExtensions, to speed up and chain the assignment or the promotion of the context properties it defines.

Unit Testing Library

Be.Stateless.BizTalk.Schemas.Unit provides helper classes and methods to write unit tests that will help the developers to avoid awkward and frustrating situations. It comes with 2 seemingly innocuous extensions methods that retrieve all the message types or schema strong names that cannot be promoted because they exceed 256 characters, see GetUnpromotableMessageTypes and GetUnpromotableSchemaStrongNames. With the help of these methods, the developers can then guard against such problems by means of automated tests similar to the following:

[Fact]
public void GetUnpromotableMessageTypes()
{
    schemaAssembly.GetUnpromotableMessageTypes().Should().BeEmpty();
}

[Fact]
public void GetUnpromotableSchemaStrongNames()
{
    schemaAssembly.GetUnpromotableSchemaStrongNames().Should().BeEmpty();
}

Remark The predicate equivalents of these 2 methods are also available, see IsPromotableMessageType and IsPromotableSchemaStrongName.

Be.Stateless.BizTalk.Schemas.Unit more importantly also provides a test base class, Be.Stateless.BizTalk.Unit.Schema.SchemaFixture<T>, to validate that XML instance document are valid with respect to their XML schema. For instance:

public class BatchFixture : SchemaFixture<Batch>
{
    [Theory]
    [InlineData("BatchContent.xml")]
    [InlineData("BatchContentWithEnvelopeSpecName.xml")]
    [InlineData("BatchContentWithEnvironmentTag.xml")]
    [InlineData("BatchContentWithEnvironmentTagAndPartition.xml")]
    [InlineData("BatchContentWithPartition.xml")]
    public void ValidateBatchContent(string resourceName)
    {
        Invoking(() => ValidateInstanceDocument(ResourceManager.Load(resourceName))).Should().NotThrow();
    }

    [Fact]
    public void PerformLaxValidation()
    {
        ValidateInstanceDocument(ResourceManager.Load("resource"), XmlSchemaContentProcessing.Lax);
    }

    ...

}

Writing these tests is particularly useful to ensure that, for instance, when the developers automate the tests of the XSLT maps, the input XML instance documents used to test the maps remain valid with respect to their XML schemas.

Developer Help

Detailed developer help has been provided as XML comments directly embedded in source code. Though developers usually browse through this documentation while developing thanks to, for instance, JetBrains ReSharper quick help —ctrl+shift+F1, an online version of this inlined help has also been provided here for greater reachability: