Codit / BizTalk-Extended

BizTalk<Extended> is an open-source project that will take your BizTalk development to the next level.
MIT License
7 stars 7 forks source link
biztalk biztalk-development

BizTalk\<Extended>

Join the chat at https://gitter.im/CoditEU/Mjolnir

BizTalk\<Extended> is an open-source project that will take your BizTalk development to the next level.

Features at a glance

BizTalk<Extended> offers the following features:

Installation

If you want to include BizTalk<Extended> in your project, you can install it directly from NuGet.

To install BizTalk<Extended>, run the following command in the Package Manager Console:

PM> Install-Package BizTalk.Extended.Pipelines.General  
PM> Install-Package BizTalk.Extended.Pipelines.Extensions
PM> Install-Package BizTalk.Extended.Orchestrations.Extensions

Documentation

Typed interaction with message context

Fixed strings in code are evil and should be avoided at all times when possible to prevent typos or breaking changes when a namespace changes, especially when interacting with the message context.

We provide you the tools to specify the type of your property and handle it all for you. You can use your own custom property schemas or existing BizTalk schemas.

To interact with these BizTalk schemas you'll need to reference Microsoft.BizTalk.GlobalPropertySchemas.dll that contains all the types. You can find it here:

C:\Program Files (x86)\Microsoft BizTalk Server 2013 R2\Microsoft.BizTalk.GlobalPropertySchemas.dll

Writing & Promoting to the context

You can write values to the context in no time! By using the WriteContextProperty you can specify to which element of your property schema you want to write and what value.

In this example we'll write the Send value to the Action element in the WCF schema.

message.WriteContextProperty<WCF.Action>("Send");

Promoting is just as easy, just use the PromoteContextProperty instead!

message.PromoteContextProperty<WCF.Action>("Send");

It also works with your custom property schemas. Here we will write Codito as CompanyName in our Customer schema.

message.PromoteContextProperty<Customer.CompanyName>("Codito");

When we look at the tracking you see that it automagically retrieves the namespace and writes the value to the context Writing to the context

You're not limited to strings, you can also pass in enumerations and we'll handle it!

message.PromoteContextProperty<Customer.SupportPlan>(SupportPlan.FirstLine);

Reading from the context

You can read values from the context as well - You simply specify the property you're interested in and what type of value you are expecting it to be.

string action = message.ReadContextProperty<WCF.Action, string>();

By default all properties are mandatory. This means that when a context property is not found in the context a ContextPropertyNotFoundException will be thrown containing the Name & Namespace of the property.

However, if you only want to read an property if it is present you can mark it as optional. This allows you to read the value if it's present and otherwise receive null and no exception will be thrown.

string action = message.ReadContextProperty<WCF.Action, string>(isMandatory: false);

Remark - Value-types will return their default value when the specified property is not present. If you want to receive a null you'll need to mark the expected type as a nullable type i.e. int?.

Planned features

For a full list of the planned features, have a look at the feature-issues here.

Requirements

In order to use this library you should meet these requirements:

License

This project is licensed under the MIT license.

Codit Logo