Parameters and example FuncLike

FuncNEQ function similar comparison for inequality in the SQL Builder function limitations SQLWhereLanguageDef.

Parameters GetFunction

GetFunction accepts the first argument type of a function funcNEQ, and then takes 2 objects to compare them with each other. The first is sent to the variable description (Variable Definition), which will determine the objects to сравнения; and the second parameter is the object that will be compared.

Note: despite the fact that when you build a constraint to a variable of type bool FuncEQ allows to send the second parameter, FuncNEQ does not allow it. Thus, the following construction will fail:

langdef.GetFunction(langdef.funcNEQ, new VariableDef(langdef.BoolType, "SomeBoolFlag"))

Let’s consider an example. Required to deduct all Кредиты not related to a particular Клиенту.

The SQL statement would look as follows:

SELECT * FROM Кредит WHERE Клиент <> '{ID}'

Where {ID} primary key desired Клиента.


Клиент клиент = new Клиент();
SQLWhereLanguageDef langdef = SQLWhereLanguageDef.LanguageDef;
Function lf = langdef.GetFunction(langdef.funcNEQ, new VariableDef(langdef.GuidType, Information.ExtractPropertyPath<Кредит>(x => x.Клиент)), клиент.__PrimaryKey);
Переведено сервисом «Яндекс.Переводчик»