tags:

views:

129

answers:

3

Is it possible to have the same assemblies behave differently in different biztalk 2006 applications?

For example, is it possible within an assembly to somehow have access to the Biztalk application Id or Name that is using that instance and then make it have different behaviours for different Biztalk applications?

Or could it be done any other way, rather then versioning the assemblies?

+2  A: 

What exactly are you trying to accomplish? That is, what kind of behavior differences are you trying to introduce?

The truth of the matter, is that there is no fool-proof way of finding out in which BizTalk application your code is executing, because the concept of Application in BizTalk is purely an admin artifact. Under some restricted circumstances, you can go out to the management database using ExplorerOM and do some queries to figure out what application an artifact (port, orchestration) belongs to, but it can be slow and might require you to adjust security.

It also might not give you the expected results depending on whether you have messages that cross application boundaries through messaging or orchestration calling.

Perhaps if you can share a bit more about what you need this for I could try offering better suggestions!

tomasr
A: 

I think versioning of the different assemblies sounds like just what you're looking for?

Riri
A: 

I solved it by using versioning, I found no other way.

I wanted to have several "instances" of the same biztalk application running together but with different configurations (not just different bindings) to simulate different environments but using the same biztalk instance. So it could interact with other pieces of software also replicated in the same machine and also external systems representing themselves the same environments and also different databases.

The problem was I had to use different conection strings to define different DBs, each one for each of the environments in the BTSNTSvc.Exe.Config file. But since the assemblies were the same, I had no way to make each biztalk application use it's own connection string, unless each assembly knew in runtime how to make that decision (by knowing to which environment it belonged, for example).

So right now, I have scripts that compile and deploy multiple versions and change the name of the connection string to use and also the versions of the assemblies (using compilation symbols).

Thanks for your help.

Sérgio Vieira