关于网友提出的“ 问个组件服务的问题SystemEnterpriseServiceServicedComponent”问题疑问,本网通过在网上对“ 问个组件服务的问题SystemEnterpriseServiceServicedComponent”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 问个组件服务的问题SystemEnterpriseServiceServicedComponent
描述: using System.EnterpriseServices;
using System.Runtime.CompilerServices;
using System.Reflection;
// Supply the COM+ application name.
[assembly: ApplicationName("BankComponent")]
// Supply a strong-named assembly.
[assembly: AssemblyKeyFileAttribute("BankComponent.snk")]
namespace BankComponent
{
[Transaction(TransactionOption.Required)]
public class Account : ServicedComponent
{
[AutoComplete]
public bool Post(int accountNum, double amount)
{
/* Updates the database; no need to call SetComplete.
Calls SetComplete automatically if no exception is
generated. */
return false;
}
}
}
using BankComponent;
namespace BankComponentConsoleClient
{
class Client
{
public static int Main()
{
try
{
Account act = new Account();
// Post money into the account.
act.Post(5, 100);
return(0);
}
catch
{
return(1);
}
}
}
}
以上介绍了“ 问个组件服务的问题SystemEnterpriseServiceServicedComponent”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2151830.html