using System; using System.EnterpriseServices; using System.Reflection; [assembly: ApplicationName("Bank")] [assembly: ApplicationActivation(ActivationOption.Server)] [assembly: ApplicationAccessControl(true)] [assembly: AssemblyKeyFile("key.snk")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: SecurityRole("Everyone", SetEveryoneAccess = true)] [assembly: SecurityRole("Teller")] [assembly: SecurityRole("Customer")] [assembly: SecurityRole("Manager")] public interface IAccount { float Read(); void Withdraw(float x); void Deposit(float x); } [ComponentAccessControl(true)] [SecurityRole("Manager")] public class Account : ServicedComponent, IAccount { float account = 1000; [SecurityRole("Customer")] [SecurityRole("Teller")] public float Read() { return account; } [SecurityRole("Customer")] public void Withdraw(float x) { account -= x; } [SecurityRole("Everyone")] public void Deposit(float x) { account += x; } }