/// <summary> /// Describe and create encoder for given schema using reflection on target entity and provided binding flags. /// </summary> /// <typeparam name="TEntity">Entity type</typeparam> /// <param name="schema">Entity schema</param> /// <param name="bindings">Binding flags used to filter bound fields and properties</param> /// <returns>Entity encoder</returns> public static IEncoder <TEntity> CreateEncoder <TEntity>(ISchema <TEntity> schema, BindingFlags bindings) { if (!Linker.LinkEncoder(schema.EncoderDescriptor, bindings, new Dictionary <Type, object>())) { throw new ArgumentException($"can't link encoder for type '{typeof(TEntity)}'", nameof(schema)); } return(schema.CreateEncoder()); }