using(TransactionContext context=TransactionContext.Instance())
            
{
                
                CustomerEntity customer 
= new CustomerEntity(cutomerGuid);
                customer.CustomerName
="test";
                customer.Save();
        }
posted @ 2005-08-16 16:17 Martin XJ 阅读(755) 评论(0) 编辑

 

//aspect code:
    [AttributeUsage(AttributeTargets.Class)]
 
public class SecurityAspectAttribute:AOPAttribute
 
{
  
public SecurityAspectAttribute()
  
{
  }


  
public override void PreProcess(System.Runtime.Remoting.Messaging.IMessage msg)
  
{
   System.Windows.Forms.MessageBox.Show(
"pre");
  }


  
public override void PostProcess(System.Runtime.Remoting.Messaging.IMessage msg)
  
{
   System.Windows.Forms.MessageBox.Show(
"post");
  }

 }

 
 
//client code:
 [SecurityAspect]
 
public class Class1:AOPObject
 
{
  
public Class1()
  
{
  }


  
public void test()
  
{
   System.Windows.Forms.MessageBox.Show(
"test");
  }

 }

posted @ 2005-08-16 16:13 Martin XJ 阅读(659) 评论(0) 编辑