Serviced Component
Fachbücher zum Thema Serviced ComponentRegistrierungDie dazu notwendige Registrierung als COM+-Anwendung wird beim ersten Start durch die CLR vorgenommen (First Use Lazy Registration), wenn die Komponente durch so genannte Meta-Attribute entsprechend gekennzeichnet ist.
VoraussetzungenDie Komponente muss einen Strong Name besitzen.
Beispielusing System.EnterpriseServices;
using System.Runtime.CompilerServices;
using System.Reflection;
// Name der COM+-Anwendung
[assembly: ApplicationName("BankComponent")]
[assembly: AssemblyKeyFileAttribute("bankcomponent.snk")]
namespace BankComponent
{
[Transaction(TransactionOption.Required)]
public class Account : ServicedComponent
{
[AutoComplete]
public bool Post(int accountNum, double amount)
{
// ...
return true;
}
}
}
Beispielusing System.EnterpriseServices;
using System.Runtime.CompilerServices;
using System.Reflection;
// Name der COM+-Anwendung
[assembly: ApplicationName("BankComponent")]
[assembly: AssemblyKeyFileAttribute("bankcomponent.snk")]
namespace BankComponent
{
[Transaction(TransactionOption.Required)]
public class Account : ServicedComponent
{
[AutoComplete]
public bool Post(int accountNum, double amount)
{
// ...
return true;
}
}
}
Aktualisiert: 15.09.2004