Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > BIZTALKSERVER (TECHNET) > - using components where to put conn
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 28th September 03:12
nirvfan_mty@hotmail-dot-comno-spaminvalid
External User
 
Posts: 1
Default - using components where to put conn



hello everybody, i have this doubt


i do not know where to store the connection strings, so not to have
them hard coded in the class library
where would you recommend to put the connection strings and everything
related, so it can be accesible

thanks in advance
  Reply With Quote


  sponsored links


2 28th September 03:19
abby
External User
 
Posts: 1
Default - using components where to put conn



Hi,

Best way to store connection string will be in BTS config file and user
helper class to retrive that so that you can make changes to connectin string
whenever is required.
Please refer the following link for more details.
http://geekswithblogs.com/asmith

Using the BTSNTSvc.exe.config

Markus Bjerke

Quite often you are in a situation where you want to use configurable values
in your orchestration, or in your custom pipeline components. A classic
example in your orchestration is that you would like to have a configurable
value for SOAP timeout or listen shapes. Some times it adds up to a number of
values you want to configure, runtime. I have seen several examples of people
using business rules to accomplish this. They define a “config” schema and
apply a policy on the message. This works, and it is configurable at runtime.
But, your SOAP timeout value is not a business rule. This is like shooting
birds with a canon, and it generates serious overhead.

The business rules approach is undesirable for several reasons:

n Applying business rules on your message is a performance overhead,
considering you don’t have to!

n You have a deployment and management overhead. You will have to deploy
/ undeploy the business rules.

n If you don’t use business rules for anything else in your solution,
you will have to install it just for this simple purpose.

The better solution is to use the configuration in the app domain. You can
easily add your config values (after all, that’s what it is, config values)
to the BTSNTSvc.exe.config file. These are easily accessible from any
component running under an In-Process host.

NOTE: there are two minor drawbacks with this approach. When you make
changes to your config values you will need to bounce the host to refresh the
values. Secondly if you have a BizTalk server group with more than one server
you will have to apply your amendments to the config files on all the
servers, just like you gac your assemblies to all the servers. But if the
host that access these values only are installed to one server, you only need
to amend this server’s config file.

So how do you go about to use the BTSNTSvc.exe.config file?

First of all you need to add a section to the config file.

<?xml version="1.0" ?>

<configuration>

<configSections>

<section name="BizTalkApplicationHosts"
type="System.Configuration.NameValueFileSectionHan dler, System,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

</configSections>

….

…


In this example I have added a section called BizTalkApplicaionHosts, you
can call it what ever you feel like. In the figure above we are only
declaring the section. Then at you have to add the actual section like this:

…

</system.runtime.remoting>

<BizTalkApplicationHosts>

<!-- Value given in seconds -->

<add key="ClientSomeTimout" value="30" />

<add key="Partner1SoapTimout" value="30" />

</BizTalkApplicationHosts>

</configuration>


When you save the file and bounce your host(s), these keys will be available.

The next challenge is to access the values so that you can use them from
your orchestration. First of all you need to declare a few variables in your
orchestration to hold these values once we extract them.

Then you need to create a custom helper class, if you already have one you
can just add a new method.

using System;

using System.Xml;

using System.Reflection;

using Microsoft.XLANGs.BaseTypes;

using System.Xml.Schema;

using System.Text.RegularExpressions;

using System.Management;

using System.Collections;

using System.Collections.Specialized;

using System.Configuration;

///

namespace Canonical.BizTalk

{

/// <summary>

/// Summary description for Namespace.

///

/// </summary>

[Serializable]

public class Util

{

public Util()

...

...


Make sure that you mark your class with the serializable attribute and that
you make your class serializable. If you forget to do this the you will be
required to use the class from within a atomic scope.

Next you add a method to extract the config values:

public string GetNameValueFileSectionHandlerKey(string keyname, string
section)

{

string keyvalue="";

NameValueCollection InitParams;


InitParams =


(NameValueCollection)ConfigurationSettings.GetConf ig(section);

keyvalue = InitParams[keyname];


return keyvalue;

}


That is all there is to it. Now you can use the helper class to extract the
config values in your orchestration like this:

SomeTimout =
System.Convert.ToInt32(BtsUtil.GetNameValueFileSec tionHandlerKey("ClientSomeTimout ","BizTalkApplicationHosts"));
  Reply With Quote
3 29th September 03:23
marian drumea
External User
 
Posts: 1
Default - using components where to put conn


Hi kerberos,

You can also use Configuration Application Block from Microsoft
Enterprise Library or even the Business Rule Engine. Nice options with
pros and cons and it is up to the effort you want to put in and the
context of what you want to do. Let me know if you want more details
about any of them.

Thanks,

Marian
http://www.MarianDrumea.com/BizTalk
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666