Show / Hide Table of Contents

Class Query

Defines a query sent into ICRUDDataStore implementor to retrieve data. A Query is a named bag of paremeters where every parameter has a name and the value.

Inheritance
System.Object
System.Collections.Generic.List<Query.Param>
Query
Query<TResultRow>
Implements
System.Collections.Generic.IList<Query.Param>
System.Collections.Generic.ICollection<Query.Param>
System.Collections.Generic.IReadOnlyList<Query.Param>
System.Collections.Generic.IReadOnlyCollection<Query.Param>
System.Collections.Generic.IEnumerable<Query.Param>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
IParameters
INamed
ICacheParams
Inherited Members
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.get_Item(System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Add(NFX.DataAccess.CRUD.Query.Param)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.AddRange(System.Collections.Generic.IEnumerable<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.AsReadOnly()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.BinarySearch(NFX.DataAccess.CRUD.Query.Param)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.BinarySearch(NFX.DataAccess.CRUD.Query.Param, System.Collections.Generic.IComparer<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.BinarySearch(System.Int32, System.Int32, NFX.DataAccess.CRUD.Query.Param, System.Collections.Generic.IComparer<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Clear()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Contains(NFX.DataAccess.CRUD.Query.Param)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.ConvertAll<TOutput>(System.Converter<NFX.DataAccess.CRUD.Query.Param, TOutput>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.CopyTo(NFX.DataAccess.CRUD.Query.Param[])
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.CopyTo(NFX.DataAccess.CRUD.Query.Param[], System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.CopyTo(System.Int32, NFX.DataAccess.CRUD.Query.Param[], System.Int32, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Exists(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Find(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindAll(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindIndex(System.Int32, System.Int32, System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindIndex(System.Int32, System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindIndex(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindLast(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindLastIndex(System.Int32, System.Int32, System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindLastIndex(System.Int32, System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.FindLastIndex(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.ForEach(System.Action<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.GetEnumerator()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.GetRange(System.Int32, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.IndexOf(NFX.DataAccess.CRUD.Query.Param)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.IndexOf(NFX.DataAccess.CRUD.Query.Param, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.IndexOf(NFX.DataAccess.CRUD.Query.Param, System.Int32, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Insert(System.Int32, NFX.DataAccess.CRUD.Query.Param)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.InsertRange(System.Int32, System.Collections.Generic.IEnumerable<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.LastIndexOf(NFX.DataAccess.CRUD.Query.Param)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.LastIndexOf(NFX.DataAccess.CRUD.Query.Param, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.LastIndexOf(NFX.DataAccess.CRUD.Query.Param, System.Int32, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Remove(NFX.DataAccess.CRUD.Query.Param)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.RemoveAll(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.RemoveAt(System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.RemoveRange(System.Int32, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Reverse()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Reverse(System.Int32, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Sort()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Sort(System.Collections.Generic.IComparer<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Sort(System.Comparison<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Sort(System.Int32, System.Int32, System.Collections.Generic.IComparer<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.Generic.IEnumerable<NFX.DataAccess.CRUD.Query.Param>.GetEnumerator()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.Add(System.Object)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.Contains(System.Object)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.IndexOf(System.Object)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.Remove(System.Object)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.ToArray()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.TrimExcess()
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.TrueForAll(System.Predicate<NFX.DataAccess.CRUD.Query.Param>)
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Capacity
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Count
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.Item[System.Int32]
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.Generic.ICollection<NFX.DataAccess.CRUD.Query.Param>.IsReadOnly
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.ICollection.IsSynchronized
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.ICollection.SyncRoot
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.IsFixedSize
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.IsReadOnly
System.Collections.Generic.List<NFX.DataAccess.CRUD.Query.Param>.System.Collections.IList.Item[System.Int32]
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: NFX.DataAccess.CRUD
Assembly: NFX.dll
Syntax
[Serializable]
public class Query : List<Query.Param>, IList<Query.Param>, ICollection<Query.Param>, IReadOnlyList<Query.Param>, IReadOnlyCollection<Query.Param>, IEnumerable<Query.Param>, IList, ICollection, IEnumerable, IParameters, INamed, ICacheParams
Remarks

Keep in mind that a particular datastore implementation may have to deal with hybrid distributed backends where different tables get stored in different repositories (different architectures i.e. NoSQL, HDFS, and some RDB SQL all in different locations), consequently one can not make assumption about writing SQLs of any kind in business code - that is what CRUD concept is for as it abstracts this into provider implementation. Architectural note: unlike Hibernate, LinqTo* and the like, the NFX.CRUD architecture purposely does not allow developers to write query scripts in higher-language like C#. This is because translation of such a high-level language abstraction into highly optimized SQL/(and or other script) per particular backend is impossible because such language can not incapsulate the optimization features of all possible data backends (i.e. ORACLE vs MongoDB vs Redis vs Files in HDFS). CRUD queries need to support selects from tables with millions of rows, or reads from collections with millions of documents, or parse millions of lines from files stored in Hadooop servers, thus every particular provider for every particular business app must expose custom-written queries by name. Those queries are usually highly optimized for particular platform (i.e. using db-specific hints, common table subexpressions, groupping sets etc.). Also, a provider may elect to SELECT * from a table named like Query object, when a hand-written script with such name is not found

Constructors

Query(Nullable<Guid>, String, IDataStoreKey, Type)

Declaration
public Query(Guid? identity, string name, IDataStoreKey key, Type resultRowType = null)
Parameters
Type Name Description
System.Nullable<System.Guid> identity
System.String name
IDataStoreKey key
System.Type resultRowType

Query(Nullable<Guid>, String, Type, Dictionary<String, Object>)

Declaration
public Query(Guid? identity, string name, Type resultRowType = null, Dictionary<string, object> extra = null)
Parameters
Type Name Description
System.Nullable<System.Guid> identity
System.String name
System.Type resultRowType
System.Collections.Generic.Dictionary<System.String, System.Object> extra

Query(String, IDataStoreKey, Type)

Declaration
public Query(string name, IDataStoreKey key, Type resultRowType = null)
Parameters
Type Name Description
System.String name
IDataStoreKey key
System.Type resultRowType

Query(String, Type, Dictionary<String, Object>)

Declaration
public Query(string name, Type resultRowType = null, Dictionary<string, object> extra = null)
Parameters
Type Name Description
System.String name
System.Type resultRowType
System.Collections.Generic.Dictionary<System.String, System.Object> extra

Properties

AllParameters

Declaration
public IEnumerable<IParameter> AllParameters { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IParameter>

CacheAbsentData

When true would cache the instance of AbsentData to signify the absence of data in the backend for key

Declaration
public bool CacheAbsentData { get; set; }
Property Value
Type Description
System.Boolean

Extra

Returns extra parameters that provider may need to render the query. May be null

Declaration
public Dictionary<string, object> Extra { get; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.String, System.Object>

Identity

Returns the identity of this instance, that is - an ID that UNIQUELY identifies the instance of this query including all of the names, parameters, values. This is needed for Equality comparison and cache lookup. The identity is either generated by .ctor or supplied to it if it is cached (i.e. in a user session)

Declaration
public Guid Identity { get; }
Property Value
Type Description
System.Guid

Item[String]

Returns parameter by its name or null

Declaration
public Query.Param this[string name] { get; }
Parameters
Type Name Description
System.String name
Property Value
Type Description
Query.Param

Name

Returns Query name, providers use it to locate SQL/scripts particular to backend implementation that they represent. QueryResolver resolves query by its name into ICRUDQueryHandler. Name is case-insensitive

Declaration
public string Name { get; }
Property Value
Type Description
System.String

ReadCacheMaxAgeSec

If greater than 0 then would allow reading a cached result for up-to the specified number of seconds. If =0 uses cache's default span. Less than 0 does not try to read from cache

Declaration
public int ReadCacheMaxAgeSec { get; set; }
Property Value
Type Description
System.Int32

ResultRowType

Returns a type of result row requested in .ctor which is always a TypedRow derivative type, or null if no particular type was requested

Declaration
public Type ResultRowType { get; }
Property Value
Type Description
System.Type

StoreKey

Returns the key if one was passed in .ctor when key is set the parameters are ignored

Declaration
public IDataStoreKey StoreKey { get; }
Property Value
Type Description
IDataStoreKey

WriteCacheMaxAgeSec

If greater than 0 then writes to cache with the expiration. If =0 uses cache's default life span. Less than 0 does not write to cache

Declaration
public int WriteCacheMaxAgeSec { get; set; }
Property Value
Type Description
System.Int32

WriteCachePriority

Relative cache priority which is used when WriteCacheMaxAgeSec>=0

Declaration
public int WriteCachePriority { get; set; }
Property Value
Type Description
System.Int32

Methods

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

FindParamByName(String)

Declaration
public IParameter FindParamByName(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
IParameter

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

ParamByName(String)

Declaration
public IParameter ParamByName(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
IParameter

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
IParameters
INamed
ICacheParams

Extension Methods

CollectionUtils.ForEach<T>(IEnumerable<T>, Action<T>)
CollectionUtils.ForEach<T>(IEnumerable<T>, Action<T, Int32>)
CollectionUtils.SkipLast<T>(IEnumerable<T>)
CollectionUtils.SkipLast<T>(IEnumerable<T>, Int32)
CollectionUtils.FirstMin<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>)
CollectionUtils.FirstMin<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>, out TComparand)
CollectionUtils.FirstMax<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>)
CollectionUtils.FirstMax<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>, out TComparand)
CollectionUtils.FirstOrAnyOrDefault<TResult>(IEnumerable<TResult>, Func<TResult, Boolean>)
CollectionUtils.Distinct<TResult, TKey>(IEnumerable<TResult>, Func<TResult, TKey>)
MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
LookAheadExtensions.AsLookAheadEnumerable<T>(IEnumerable<T>)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX