2014-06-12 2 views
1

VB .net에서 postSharp 라이브러리로 만든 내 Aspect에 대한 내 속성을 설정하려고 시도 중입니다. 내가 어떻게 해? 내 방법 전에 내 CurrentTool 속성을 지정 할 수 있도록 전화를 어떻게PostSharp VB.NET에서 Aspect를 호출 할 때 속성을 설정하는 방법

<Serializable()> 
Public Class MyAspect 
    Inherits OnMethodBoundaryAspect 

    Public Property CurrentTool As String 

    Public Overrides Sub OnEntry(ByVal eventArgs As PostSharp.Aspects.MethodExecutionArgs) 
     MyBase.OnEntry(eventArgs) 
     eventArgs.MethodExecutionTag = Stopwatch.StartNew() 
    End Sub 

    Public Overrides Sub OnExit(ByVal eventArgs As PostSharp.Aspects.MethodExecutionArgs) 
     MyBase.OnExit(eventArgs) 
     Dim sw As Stopwatch = CType(eventArgs.MethodExecutionTag, Stopwatch) 
     sw.Stop() 

     Log.log("Method: " & eventArgs.Instance.GetType().Name & "." & eventArgs.Method.Name & " - Total time:" + CStr(sw.ElapsedMilliseconds/1000), " seconds.") 

    End Sub 


End Class 

: 여기

내 측면이다? 이 코드는 아래 작동하지 않기 때문에 ..

<MyAspect(CurrentTool = "LOGIN")> 
Private Sub CallTologInFeature() 
    ... 
End Sub 

답변

0

속성의 속성 값을 설정할 때 := 연산자를 사용합니다.

<MyAspect(CurrentTool:="LOGIN")> 
Private Sub CallTologInFeature() 
... 
End Sub 
+0

작동합니다! 많은 감사합니다! – Dom