Exemple #1
0
        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);
        }
Exemple #2
0
 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);
 }
Exemple #3
0
 public void Add <T>(ILayoutParserFactory <T, TSchema> factory)
     where T : Layout
 {
     _schemaBuilder.Add(factory);
 }
Exemple #4
0
 /// <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)));
 }
Exemple #5
0
 public void Add <T>(ILayoutParserFactory <T, TSchema> factory)
     where T : Layout
 {
     _layouts.Add(typeof(T), factory);
 }
Exemple #6
0
 public void Add <T>(ILayoutParserFactory <T, TSchema> factory)
     where T : Layout
 {
     _layouts[factory.LayoutType] = factory;
 }