Class OptionalFilterAttribute
Base optional filter attribute
Inheritance
OptionalFilterAttribute
Inherited Members
Namespace: XData.Mapping
Assembly: XData.docfx.dll
Syntax
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public abstract class OptionalFilterAttribute : FilterAttribute
Remarks
Optional filters can be used to conditionally omit parts of query
If filter marked by PrimaryFilter = true has no value assigned - it cause omit it primary source from query
If link marked by PrimaryFilter = true has one of sources omitted - it cause omit other source from query two
If base source BaseSource is omitted - all entire query is omitted
Hint: It can be used to build conditional sub queries or inner views
For example:
-- if filterBySomeField has PrimaryFilter flag = true, query...
select ot.one_table_id, ot.name from one_table ot where ot.one_table_id in (select st.one_table_id from second_table st where st.some_field = :filterBySomeField)
-- when filterBySomeField has no value assigned will be transformed into...
select one_table_id, name from one_table
-- bat have a full form when filterBySomeField value is assigned
Constructors
| Improve this Doc View SourceOptionalFilterAttribute(String, String)
Base optional filter attribute
Declaration
protected OptionalFilterAttribute(string sourceAlias, string fieldName)
Parameters
Type | Name | Description |
---|---|---|
String | sourceAlias | Primary source alias |
String | fieldName | Primary field name |
Properties
| Improve this Doc View SourcePrimaryFilter
Primary filter flag
Declaration
public bool PrimaryFilter { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Extension Methods
SqlBlockExtensions.SetExpression<TTag, TResult>(TTag, Expression<Func<IBlockQueryAdapter, TResult>>)