Skip to the content.

Be.Stateless.Runtime

Build Pipelines

Latest Release

Release Preview

Overview

Be.Stateless.Runtime is part of the BizTalk.Factory Runtime Package. This component provides service injection at the startup of any .NET Framework managed process and caching abstractions.

Service Injection

Service injection relies on the StartupServiceManager class, which technically is a configurable AppDomainManager that injects services at the startup of any .NET Framework managed process, thus allowing any custom infrastructure code to be executed before any other managed code run —the StartupServiceManager injects services whenever an AppDomain is created. To enable the StartupServiceManager for a .NET Framework process, one has to register it as an AppDomainManager in the XML configuration file of the process, as follows:

<configuration>
  ...
  <runtime>
    ...
    <appDomainManagerAssembly value="Be.Stateless.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3707daa0b119fc14" />
    <appDomainManagerType value="Be.Stateless.Runtime.StartupServiceManager" />
    ...
  </runtime>
    ...
</configuration>

The StartupServiceManager has its own XML configuration section, which must be declared as follows —notice that its important to respect the nesting of the XML elements, namely be.stateless\runtime\startup, or the StartupServiceManager will not be able to load its configuration:

<configuration>
  <configSections>
    ...
    <sectionGroup name="be.stateless">
      <sectionGroup name="runtime">
        <section name="startup"
                 type="Be.Stateless.Runtime.Configuration.StartupServiceManagerConfigurationSection, Be.Stateless.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3707daa0b119fc14" />
      </sectionGroup>
    </sectionGroup>
    ...
  </configSections>

  ...

</configuration>

Once loaded by the CLR, StartupServiceManager will immediately load its configuration to determine the services that need to be injected every time an AppDomain is created. To be successfully injected, a service must implement the IStartupService interface; failure to do so will generate runtime errors that will be reported as Windows Event Logs. The following XML configuration excerpt demonstrates how to declare such a service.

<configuration>

  ...

  <be.stateless>
    <runtime>
      <startup>
        <services>
          <service type="Be.Stateless.BizTalk.Factory.Logging.LoggingConfigurationLoader, Be.Stateless.BizTalk.Factory.Logging, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3707daa0b119fc14" />
        </services>
      </startup>
    </runtime>
  </be.stateless>

  ...

</configuration>

Remark By injecting a LoggingConfigurationLoader startup service in BTSNTSvc[64].exe processes, the BizTalk.Factory runtime ensures that log4net has loaded its configuration before any attempt to create a logger is made.

Caching Abstractions

Caching abstractions provide both absolute and sliding expiration caches that are used pervasively in BizTalk.Factory to cache things like schema metadata, compiled XSLTs, compiled regular expressions, and so on…

Developer Help

Detailed developer help has been provided as XML comments directly embedded in source code. Though developers usually browse through this documentation while developing thanks to, for instance, JetBrains ReSharper quick help —ctrl+shift+F1, an online version of this inlined help has also been provided here for greater reachability: