public static void BindFunction(this SQLiteConnection connection, SQLiteFunction function) { var attributes = function.GetType().GetCustomAttributes(typeof(SQLiteFunctionAttribute), true).Cast <SQLiteFunctionAttribute>().ToArray(); if (attributes.Length <= 0) { throw new InvalidOperationException("SQLiteFunction doesn't have SQLiteFunctionAttribute"); } connection.BindFunction(attributes[0], function); }
// TODO: upgrade System.Data.SQLite version // is support Bind Function (SQLiteFunction.BindFunction) // public void RegisterFunction(SQLiteFunction sqlfunc) { var attributes = sqlfunc.GetType().GetCustomAttributes(typeof(SQLiteFunctionAttribute), true);//.Cast<SQLiteFunctionAttribute>().ToArray(); if (attributes.Length == 0) { throw new InvalidOperationException(Properties.Resources.DBFunctionEmptyAttribute); } /* * SQLiteFunction.BindFunction(this.dbConn, attributes, sqlfunc, null); */ }
public static void BindFunction(this SQLiteConnection connection, SQLiteFunction function) { var attr = function.GetType().GetCustomAttributes(typeof(SQLiteFunctionAttribute), false).FirstOrDefault() as SQLiteFunctionAttribute; connection.BindFunction(attr, function); }