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:
-
Any.xsd, whose type’s full name is
Be.Stateless.BizTalk.Schemas.Xml.Any
, which is as its name suggests anXML
schema for anyXML
document instance; -
Envelope.xsd, whose type’s full name is
Be.Stateless.BizTalk.Schemas.Xml.Envelope
, which is a generic and reusable envelope schema.
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:
-
CorrelationId
, which denotes the identifier of the correlation; -
EnvironmentTag
, which is to be used when one Microsoft BizTalk Server® application has to be connected to several distinct and non-overlapping sets of interacting parties —or environments— and cannot leak messages from one set of parties into another. In concrete terms, it is meant to be used in pub/sub scenarios —i.e. promoted into message context with a pending subscription filter— in order to keep messages strictly insulated within a particular set of such interacting parties; -
ReceiverName
, which denotes the name of the intended receiver of the current message. This is a generic token not to be confused with a ReceivePort name; -
SenderName
, which denotes the name of the initiating sender of the current message. This is a generic token not to be confused with a ReceivePort name;
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: