Class CriteriaExtension
This class adds extension methods to CriteriaFilter class.
Inheritance
Namespace: Ellucian.Ethos.Integration.Client.Filter.Extensions
Assembly: Ellucian.Ethos.Integration.dll
Syntax
public static class CriteriaExtension : object
Methods
WithArray(CriteriaFilter, String, Dictionary<String, Object>)
Example:
//Creates ?criteria={"names":[{"lastName":"Smith"},{"firstName":"John"}]}
Dictionary<string, object> names = new Dictionary<string, object>();
names.Add( "lastName", "smith" );
names.Add( "fistName", "Jon" );
var result = new Criteria().WithArray( "names", names ).BuildCriteria();
Declaration
public static CriteriaFilter WithArray(this CriteriaFilter criteria, string label, Dictionary<string, object> values)
Parameters
| Type | Name | Description |
|---|---|---|
| CriteriaFilter | criteria | |
| System.String | label | Root label. |
| Dictionary<System.String, System.Object> | values | A |
Returns
| Type | Description |
|---|---|
| CriteriaFilter | CriteriaFilter represents an object whose members can be dynamically added and removed at run time. |
WithArray(CriteriaFilter, String, Object[])
Examples:
//Creates ?criteria={"credentials":[{"type":"bannerSourcedId","value":"684"}]}
string criteriaFilterStr = new CriteriaFilter().WithArray( "credentials", new CriteriaFilter()
.WithSimpleCriteria( "type", "bannerSourcedId" )
.WithSimpleCriteria( "value", "684" ) ).BuildCriteria();
//Creates vendors?criteria={"statuses":["active","approved"]}
var result = new Criteria().WithArray( "statuses", new [] { "active", "approved" } ).BuildCriteria();
Declaration
public static CriteriaFilter WithArray(this CriteriaFilter criteria, string label, params object[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| CriteriaFilter | criteria | |
| System.String | label | Root label. |
| System.Object[] | values | params |
Returns
| Type | Description |
|---|---|
| CriteriaFilter | CriteriaFilter represents an object whose members can be dynamically added and removed at run time. |
WithArray(CriteriaFilter, String, (String key, Object value)[])
Example:
//Creates ?criteria={"emails":[{"address":"abc@def.com"},{"address":"12345@abc.com"}]}
string resource = "persons";
string email1 = "abc@def.com";
string email2 = "12345@abc.com";
string criteriaFilterStr = new Criteria().WithArray( "emails", ("address", email1), ("address", email2) ).BuildCriteria();
Declaration
public static CriteriaFilter WithArray(this CriteriaFilter criteria, string label, params (string key, object value)[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| CriteriaFilter | criteria | |
| System.String | label | Root label. |
| System.ValueTuple<System.String, System.Object>[] | values |
Returns
| Type | Description |
|---|---|
| CriteriaFilter | CriteriaFilter represents an object whose members can be dynamically added and removed at run time. |
WithSimpleCriteria(CriteriaFilter, String)
Example:
//Creates ?criteria={"solicitors":[{"solicitor":{"constituent":{"person":{"id":"11111111-1111-1111-1111-111111111111"}}}},{"solicitor":{"constituent":{"person":{"id":"11111111-1111-1111-1111-111111111111"}}}}]}
var solicitors = new Criteria().WithSimpleCriteria( "constituent", new Criteria().WithSimpleCriteria( "person", ("id", "11111111-1111-1111-1111-111111111111") ) ).WithSimpleCriteria( "solicitor" );
var filter = new Criteria().WithArray( "solicitors", solicitors, solicitors ).BuildCriteria();
Declaration
public static CriteriaFilter WithSimpleCriteria(this CriteriaFilter criteria, string label)
Parameters
| Type | Name | Description |
|---|---|---|
| CriteriaFilter | criteria | CriteriaFilter Represents an object whose members can be dynamically added and removed at run time. |
| System.String | label | The label for the json object. |
Returns
| Type | Description |
|---|---|
| CriteriaFilter | CriteriaFilter represents an object whose members can be dynamically added and removed at run time. |
WithSimpleCriteria(CriteriaFilter, String, Object)
Example:
//Creates ?criteria={"lastName":"Smith"}
var criteria = new Criteria().WithSimpleCriteria( "lastName", "Smith" );
Declaration
public static CriteriaFilter WithSimpleCriteria(this CriteriaFilter criteria, string key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| CriteriaFilter | criteria | |
| System.String | key | key for the json object. |
| System.Object | value | value for the json object. |
Returns
| Type | Description |
|---|---|
| CriteriaFilter | CriteriaFilter represents an object whose members can be dynamically added and removed at run time. |
WithSimpleCriteria(CriteriaFilter, String, (String key, Object value))
Example:
//Creates ?criteria={"names":{"lastName":"Smith"}}
var criteria = new Criteria().WithSimpleCriteria( "names", ("lastName", "Smith") );
Declaration
public static CriteriaFilter WithSimpleCriteria(this CriteriaFilter criteria, string label, (string key, object value) tuple)
Parameters
| Type | Name | Description |
|---|---|---|
| CriteriaFilter | criteria | |
| System.String | label | The label for the json object. |
| System.ValueTuple<System.String, System.Object> | tuple |
Returns
| Type | Description |
|---|---|
| CriteriaFilter | CriteriaFilter Represents an object whose members can be dynamically added and removed at run time. |
WithSimpleCriteria(CriteriaFilter, String, (String key, Object value)[])
Example:
//Creates ?criteria={"names":{"firstName":"John","lastName":"Smith"}}
filter = new Criteria().WithSimpleCriteria( "names", ("firstName", "John"), ("lastName", "Smith") );
Declaration
public static CriteriaFilter WithSimpleCriteria(this CriteriaFilter criteria, string label, params (string key, object value)[] tuples)
Parameters
| Type | Name | Description |
|---|---|---|
| CriteriaFilter | criteria | CriteriaFilter Represents an object whose members can be dynamically added and removed at run time. |
| System.String | label | The label for the json object. |
| System.ValueTuple<System.String, System.Object>[] | tuples | Array of |
Returns
| Type | Description |
|---|---|
| CriteriaFilter | CriteriaFilter represents an object whose members can be dynamically added and removed at run time. |