public ICompiled Compile() { SetType(PartType.Compiled); var state = new CompileState(PersistenceProvider.SupportedTypeMappings, PersistenceProvider.Translator); Query[] parts = GetParts(); ForEach(parts, state.Text, "\r\n", item => item?.Compile(state)); CompiledQuery = new CompiledQuery(state, parts.Last(item => item.Last).AsResults ?? new AsResult[0]); if (CompiledQuery.Errors.Count > 0) { throw new QueryException(CompiledQuery); } return(this); }
public QueryException(CompiledQuery query) : base($"There were errors during compilation of the query. Please check the exception details.") { QueryText = query.QueryText; QueryParameters = query.Parameters.Select(item => $"Parameter: Name = {item.Name}, Type = {item.Type?.FullName ?? "NULL"}").ToArray(); ErrorMessages = query.Errors.Select(item => $"Error: {item}").ToArray(); }