Ox.BizTalk.BAM.Framework 1.0.1

dotnet add package Ox.BizTalk.BAM.Framework --version 1.0.1
NuGet\Install-Package Ox.BizTalk.BAM.Framework -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ox.BizTalk.BAM.Framework" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ox.BizTalk.BAM.Framework --version 1.0.1
#r "nuget: Ox.BizTalk.BAM.Framework, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ox.BizTalk.BAM.Framework as a Cake Addin
#addin nuget:?package=Ox.BizTalk.BAM.Framework&version=1.0.1

// Install Ox.BizTalk.BAM.Framework as a Cake Tool
#tool nuget:?package=Ox.BizTalk.BAM.Framework&version=1.0.1

Ox.BizTalk.BAM.Framework

This solution provides a framework for the BizTalk BAM API. It contains some friendly wrappers to the API which makes implementing activities easy through the use of typed classes and properties.

Dependencies

Ox.BizTalk.BAM top level project is dependent on Microsoft.BizTalk.Bam.EventOrchestration.dll, which is provided as part of the BizTalk install and is freely redistributale within your organisation providing you have a BizTalk license. This is a standalone DLL.

Ox.BizTalk.BAM.OrchestrationStream relies on Microsoft.BizTalk.Bam.XLANGs.dll, which is also provided as part of a BizTalk install, but is not for redistribution. You won't need this DLL unless you're consuming the BAM API from within an Orchestration. This chains on to a lot of other DLLs.

In order to build this code, you will need a copy of BizTalk Server installed on your build machine. Don't forget to sign it and GAC it if you're planning on consuming from BizTalk Server.

Usage

  1. Extend Ox.BizTalk.BAM.ActivityBase and add the properties that correspond to the BAM Activity that needs to be written.
  2. Inject the relevant EventStream (Bufffered,Direct).
  3. Call your desired BAM actions.

You can use the ActivityFactory to generate a new instance of your activity class with the desired event stream.

To use OrchestrationEventStream with this framework you will need to use Ox.BizTalk.BAM.OrchestrationEventStreamWrapper to make it compatible with BaseActivity.

Declaring an activity

Match your BAM activity structure with a POCO class

using Ox.BizTalk.BAM;

[BamActivity(Name="My Activity")]   // Optional if class name isn't compatible
public class MyActivity : ActivityBase
{
    public MyActivity() : base() {}

    public MyActivity(IEventStreamMediator eventStreamMediator, string activityId = null) : base(eventStreamMediator, activityId) {}

    public string Field1 { get; set;}

    // Using the NullifyDefaultValues setting will transparently convert a
    // DateTime with the default value to NULL when inserting into the DB
    // Useful as BizTalk doesn't work well with Nullable<T> types
    [BamField(NullifyDefaultValues = true)]
    public DateTime Field2 { get; set; }

    // Use the FieldName setting if required to name the backend field
    [BamField(FieldName = "3rd Field")]
    public string Field3 { get; set; }
}

Consuming your activity

Instantiate a copy of your activity

// To call from an Orchestration
myActivity = new MyActivity(new Ox.BizTalk.BAM.EventStreamMediator(new Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream()));

// Or use a factory elsewhere
myActivity = ActivityFactory.NewBufferedActivity<MyActivity>(connectionString);

Then call your desired actions

myActivity.Field1 = "What's up doc?";
myActivity.BeginActivity();
myActivity.CommitActivity();
myActivity.EndActivity();

There are other functions available, such as the ability to add a reference to another activity, and enabling continuations.

The above examples use automatically generated Activity Ids, but if you're working with continuations then you may want to provide a custom one, this can either be done via the constructor, factory or via setting the ActivityId property directly (but only once eh?).

Cleaning up

As most of the event streams supplied by BizTalk implement IDisposable, so does this. You can either call .Dispose() on your activity, or wrap it up in a using() statement.

Copyright (c) 2019. Alastair Grant. https://www.aligrant.com/

Licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Ox.BizTalk.BAM.Framework:

Package Downloads
Ox.BizTalk.BAM.Framework.OrchestrationStream

Provides OrchestrationEventStream wrapper to Ox.BizTalk.BAM Typed API framework. Requires Microsoft BizTalk Server to be installed.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 545 1/16/2020
1.0.0 798 12/16/2019

v1.0.1 - Fixed ActivityId not being set with non-generic factory