getcustomattributes

Unity Interception GetCustomAttribute

Deadly 提交于 2020-01-04 01:53:53
问题 Thanks in advance for your help! (Yes, there's a question at the bottom) I'm using Unity 3.x Interception to perform AOP pre and post database connection and transaction activities. The database interceptor is always instantiated and the transaction interceptor is CustomAttributeMatchingRule based, both via InterfaceInterceptor. I have properties that are being set in my TransactionAttribute: [Transaction(IsolationLevel.ReadUncommitted, NoRollbackFor = new[] { typeof(TestException) })] as an

Calling Custom Assembly Attributes

◇◆丶佛笑我妖孽 提交于 2019-12-12 03:54:49
问题 I have created a custom attribute and use it in the AssemblyInfo.vb file. The attribute is declared in another file like so: Public NotInheritable Class AssemblyBuildNameAttribute Inherits Attribute Private _p1 As String Sub New(p1 As String) ' TODO: Complete member initialization _p1 = p1 End Sub End Class And is in the AssemblyInfo.vb file like so: <Assembly: AssemblyVersion("0.4.15")> <Assembly: AssemblyFileVersion("13.10.1.8")> <Assembly: AssemblyBuildName("alpha")> How can I call this

System.Type.GetCustomAttributes on an assembly loaded from a network share is not showing all attributes

半世苍凉 提交于 2019-12-02 13:03:25
问题 I have a managed dll – repro.dll, which contains class TestModuleCommand decorated with 2 attributes: System.ObsoleteAttribute and System.Management.Automation.CmdletAttribute (comes from System.Management.Automation.dll which is in the GAC in Windows 7) namespace Test { [System.Obsolete] [System.Management.Automation.Cmdlet("Test", "Module")] public class TestModuleCommand : System.Management.Automation.PSCmdlet { protected override void ProcessRecord() { this.WriteObject("In test-module");

How do I GetCustomAttributes?

强颜欢笑 提交于 2019-11-27 03:11:19
问题 I have tried the following code using the 2.0 framework and I get an attribute back, but when I try this on the compact framework, it always returns an empty array. The MSDN documenation says its supported, am I doing something wrong? Test x = new Test(); FieldInfo field_info = x.GetType().GetField("ArrayShorts"); object[] custom_attributes = field_info.GetCustomAttributes(typeof(MarshalAsAttribute), false); [StructLayout(LayoutKind.Sequential)] public struct Test { [MarshalAs(UnmanagedType