public void Apply(ILayoutBuilder <TLayout, TSchema> builder) { ILayoutParserFactory <T, TSchema> layout = builder.GetLayout <T>(); var property = new LayoutListLayoutProperty <TLayout, TSchema, T>(builder.ImplementationType, _property, layout, Required); builder.Add(property); }
public LayoutLayoutProperty(Type implementationType, PropertyInfo property, ILayoutParserFactory <T, TSchema> layout, bool required) { _layout = layout; _required = required; _property = new WriteProperty <TLayout, Layout <T> >(implementationType, property.Name); }
public void Add <T>(ILayoutParserFactory <T, TSchema> factory) where T : Layout { _schemaBuilder.Add(factory); }
/// <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 void Add <T>(ILayoutParserFactory <T, TSchema> factory) where T : Layout { _layouts.Add(typeof(T), factory); }
public void Add <T>(ILayoutParserFactory <T, TSchema> factory) where T : Layout { _layouts[factory.LayoutType] = factory; }