Esempio n. 1
0
        public void CreateExternalFunction()
        {
            var funName    = ObjectName.Parse("APP.fun1");
            var parameters = new RoutineParameter[] {
                new RoutineParameter("a", PrimitiveTypes.Integer()),
                new RoutineParameter("b", PrimitiveTypes.Integer()),
            };

            var externRef = ExternalRef.MakeRef(typeof(Test), "Function(int, int)");

            AdminQuery.CreateExternFunction(funName, PrimitiveTypes.Integer(), parameters, externRef.ToString());

            var exists = AdminQuery.Access().RoutineExists(funName);

            Assert.IsTrue(exists);

            var function = AdminQuery.Access().GetObject(DbObjectType.Routine, funName);

            Assert.IsNotNull(function);
            Assert.IsInstanceOf <ExternalFunction>(function);

            var externFunction = (ExternalFunction)function;

            Assert.IsNotNull(externFunction.ExternalRef);
            Assert.AreEqual(typeof(Test), externFunction.ExternalRef.Type);
        }