public Parser <TSchema, LayoutMatch <TLayout> > CreateQuery(LayoutParserOptions options, IQueryBuilder <TSchema> queryBuilder) { Parser <TSchema, T> parser = _layout.CreateParser(options, queryBuilder); var listParser = _required ? parser.OneOrMore() : parser.ZeroOrMore(); return(new LayoutListLayoutParser <TLayout, TSchema, T>(listParser, this)); }
/// <summary> /// Create a query using the document to infer the schema type, which is not specifically tied to the document, but easy to discover. /// It's better to create a query using <see cref="Query{TSchema}.Create{T}"/> in advance, but really no difference. /// </summary> /// <param name="entityResult">A parsed text</param> /// <param name="parserFactory"></param> /// <param name="options"></param> /// <typeparam name="T">The query result type</typeparam> /// <typeparam name="TSchema">The schema type</typeparam> /// <returns></returns> public static Parser <TSchema, T> CreateQuery <TSchema, T>(this EntityResult <TSchema> entityResult, ILayoutParserFactory <T, TSchema> parserFactory, LayoutParserOptions options = LayoutParserOptions.None) where TSchema : Entity where T : Layout { return(Query <TSchema> .Create(qb => parserFactory.CreateParser(options, qb))); }
public IParser <TSchema, LayoutMatch <TLayout> > CreateQuery(LayoutParserOptions options, IQueryBuilder <TSchema> queryBuilder) { IParser <TSchema, T> parser = _layout.CreateParser(options, queryBuilder); if (_required == false) { parser = parser.Optional(); } return(new LayoutLayoutParser <TLayout, TSchema, T>(parser, this)); }