/******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; /// /// A simple custom attribute to enable us to easily find user-defined functions in /// the loaded assemblies and initialize them in SQLite as connections are made. /// [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] public sealed class SQLiteFunctionAttribute : Attribute { private string _name; private int _argumentCount; private FunctionType _functionType; private Type _instanceType; /// /// Default constructor, initializes the internal variables for the function. /// public SQLiteFunctionAttribute() : this(String.Empty, -1, FunctionType.Scalar) { // do nothing. } /// /// Constructs an instance of this class. /// /// /// The name of the function, as seen by the SQLite core library. /// /// /// The number of arguments that the function will accept. /// /// /// The type of function being declared. This will either be Scalar, /// Aggregate, or Collation. /// public SQLiteFunctionAttribute( string name, int argumentCount, FunctionType functionType ) { _name = name; _argumentCount = argumentCount; _functionType = functionType; _instanceType = null; } /// /// The function's name as it will be used in SQLite command text. /// public string Name { get { return _name; } set { _name = value; } } /// /// The number of arguments this function expects. -1 if the number of arguments is variable. /// public int Arguments { get { return _argumentCount; } set { _argumentCount = value; } } /// /// The type of function this implementation will be. /// public FunctionType FuncType { get { return _functionType; } set { _functionType = value; } } /// /// The object instance that describes the class /// containing the implementation for the associated function. /// internal Type InstanceType { get { return _instanceType; } set { _instanceType = value; } } } }