Skip to content

Add a Validate function that inspects a fetch request #30

Description

@tspence

Right now Searchlight uses exceptions to indicate that parsing failed. It might be better instead to produce a list of validation results, so that if more than one error could be determined at a time we could use that rather than the exception system.

Today, the code looks like this:

try {
    var request = new FetchRequest() { ... };
    var syntax = engine.Parse(request);
    var sql = syntax.ToSqlServerCommand(true);
} catch (e) { ... }

However, some programmers may not want to use exceptions. Why don't we also support a Validate() or TryParse() method? Then, the code could look like this:

var request = new FetchRequest() { ... };
if (!engine.Validate(request, out errors)) {
  Console.WriteLine(errors.ToString());
}
if (engine.TryParse(request, out syntax)) { 
  // Execute the syntax
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions