protected FilterFieldDescriptorBase( IDescriptorContext context, PropertyInfo property) : base(context) { _namingConvention = context.GetFilterNamingConvention(); Definition.Property = property ?? throw new ArgumentNullException(nameof(property)); Definition.Name = context.Naming.GetMemberName( property, MemberKind.InputObjectField); Definition.Description = context.Naming.GetMemberDescription( property, MemberKind.InputObjectField); Definition.Type = context.Inspector.GetInputReturnType(property); Definition.Filters.BindingBehavior = context.Options.DefaultBindingBehavior; }
protected FilterInputTypeDescriptor( IDescriptorContext context, Type entityType) : base(context) { IFilterNamingConvention convention = context.GetFilterNamingConvention(); Definition.EntityType = entityType ?? throw new ArgumentNullException(nameof(entityType)); Definition.ClrType = typeof(object); Definition.Name = convention.GetFilterTypeName(context, entityType); // TODO : should we rework get type description? Definition.Description = context.Naming.GetTypeDescription( entityType, TypeKind.Object); Definition.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; }
private static void CompileMiddleware( ICompletionContext context, ObjectFieldDefinition definition, ITypeReference argumentTypeReference, FieldMiddleware placeholder) { IFilterNamingConvention convention = context.DescriptorContext.GetFilterNamingConvention(); IFilterInputType type = context.GetType <IFilterInputType>(argumentTypeReference); Type middlewareType = _middlewareDefinition.MakeGenericType(type.EntityType); FieldMiddleware middleware = FieldClassMiddlewareFactory.Create(middlewareType, FilterMiddlewareContext.Create(convention.ArgumentName)); int index = definition.MiddlewareComponents.IndexOf(placeholder); definition.MiddlewareComponents[index] = middleware; }
private static ArgumentDefinition ConfigureArgumentName( this ArgumentDefinition definition) { ILazyTypeConfiguration lazyArgumentConfiguration = LazyTypeConfigurationBuilder .New <ArgumentDefinition>() .Definition(definition) .Configure((context, definition) => { IFilterNamingConvention convention = context.DescriptorContext.GetFilterNamingConvention(); definition.Name = convention.ArgumentName; }) .On(ApplyConfigurationOn.Completion) .Build(); definition.Configurations.Add(lazyArgumentConfiguration); return(definition); }