Project Description
BAM Service Generator is a command line tool for generating typed .NET 4.0 WCF service layer wrapping the BAM API. This makes it possible to log data via BAM even from without the firewalls and enables logging from client that isn’t based on .NET.
BAM today offers a untyped API for inserting values into the BAM infrastructure. BAM Service Generator reads a BAM definition file and uses these fields and activity names to generate a set typed WCF service for each found activity within the file. The services are then compiled into a service dll and service host files. These files can then be deployed into IIS/AppFabric or similar hosting to expose a service that makes it possible to write to deployed BAM activity and its corresponding database infrastructure. Further explanation and details on how the tool works can be found here.
How to generate services
The command line tool expects the following arguments:
Example usage:
bmsrvgen.exe -defintionfile:”c:\MyFiles\MyActivityDef.xml” -output:”c:\tempservices” -nampespace:”Test.TestServices”
How to use the generated services
Each generated activity service will have the below operation available. Each one of them and usage are further explain in the documentation here.
Example of a service call:
string activityId = Guid.NewGuid().ToString(); //Create a unique activity id
var srv = new ApprovedInvoicesServiceClient(); //Create a instance of the service
srv.BeginActivity(activityId); //Begin the activity using the generated id
srv.UpdateActivity(activityId, new ApprovedInvoicesServiceType() { Amount = 2, ApprovedDate = SqlDateTime.MinValue.Value, InvoiceId = "1001" }); //Make first and insert typed logging data
srv.UpdateActivity(activityId, new ApprovedInvoicesServiceType() { Amount = 2, ApprovedBy = "xx", ApprovedDate = DateTime.Now }); //Make an update to the previously logged line. In this case we’ll add the ApprovedBy parameter
srv.EndActivity(activityId); //End the activity
More examples of how to use the service operations can be found here.