public IEncoderDescriptor <TField> HasField <TField>(string name, Func <TEntity, TField> getter) { var fieldDefinition = this.definition.Create <TField>(); var fieldDescriptor = new TreeEncoderDescriptor <TState, TNative, TField>(this.converter, fieldDefinition); return(TreeEncoderDescriptor <TState, TNative, TEntity> .BindField(this.definition, name, this.fields, getter, fieldDescriptor)); }
public IEncoderDescriptor <TField> HasField <TField>(string name, Func <TEntity, TField> getter, IEncoderDescriptor <TField> descriptor) { if (!(descriptor is TreeEncoderDescriptor <TState, TNative, TField> ancestor)) { throw new ArgumentOutOfRangeException(nameof(descriptor), "incompatible descriptor type"); } return(TreeEncoderDescriptor <TState, TNative, TEntity> .BindField(this.definition, name, this.fields, getter, ancestor)); }