/// <summary> /// Compiles the fragment. /// </summary> /// <param name="queryBuilder">The query builder.</param> /// <param name="engine">The engine.</param> public override void Compile(QueryBuilder queryBuilder, IEngine engine) { IFunctionData funcData = engine.GetFunction(Name); if (engine.Options.FunctionsOnlyRegistered && funcData == null) { throw new InvalidConfigurationException($"Function \"{Name}\" is not registered."); } if (funcData?.Compile != null) { funcData.Compile(queryBuilder, engine, funcData.Name ?? Name, this); } else { queryBuilder.Write(funcData?.Name ?? Name).Write("("); if (BeforeArgs != null) { queryBuilder.WriteFragment(BeforeArgs).Write(" "); } if (Values.Count > 0) { base.Compile(queryBuilder, engine); } queryBuilder.Write(")"); } }