ContextDataProviderAttribute
This attribute is used to specify the Type of class that implements
IContextDataProvider interface in the specified assembly. This
attribute can be used only once at assembly level. Having this attribute
saves the cost of reflection on each exported types to find the type
that implements IContextDataProvider interface.
using System;
namespace Autodesk.DesignScript.Runtime
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
internal sealed class ContextDataProviderAttribute : Attribute
{
private Func<bool> mCapturesData = () => true;
public Type Type { get; set; }
public bool CapturesData => mCapturesData();
public ContextDataProviderAttribute(Type dataProviderType, Func<bool> capturesData)
{
Type = dataProviderType;
if (capturesData != null)
mCapturesData = capturesData;
}
public ContextDataProviderAttribute(Type dataProviderType)
{
Type = dataProviderType;
}
}
}