/// <summary> /// This method will create a Select statement for all of the columns in the entity except for the ones passed in. /// This is very useful when you want to eliminate blobs and other fields for performance. /// </summary> /// <param name="columns">The columns which you wish to exclude from the Select statement</param> /// <returns></returns> override public tgDynamicQuerySerializable SelectAllExcept(params tgQueryItem[] columns) { foreach (tgColumnMetadata col in this.Meta.Columns) { bool found = false; for (int i = 0; i < columns.Length; i++) { if (col.Name == (string)columns[i]) { found = true; break; } } if (found) { continue; } tgExpression item = new tgQueryItem(this, col.Name, col.esType); this.Select(item); } return(this); }
public tgCase Else(tgQueryItem queryItem) { tgExpression expression = queryItem; this.data.Else = expression; return(this); }
/// <summary> /// This method will select all of the columns that were present when you generated your /// classes as opposed to doing a SELECT * /// </summary> /// <returns></returns> override public tgDynamicQuerySerializable SelectAll() { foreach (tgColumnMetadata col in this.Meta.Columns) { tgQueryItem item = new tgQueryItem(this, col.Name, col.esType); this.Select(item); } return(this); }
private void _selectAll() { if (this.m_selectAll) { foreach (tgColumnMetadata col in this.Meta.Columns) { tgQueryItem item = new tgQueryItem(this, col.Name, col.esType); this.Select(item); } this.m_selectAll = false; } }
public tgCase Then(tgQueryItem queryItem) { tgExpression expression = queryItem; tgSimpleCaseData.tgCaseClause clause = new tgSimpleCaseData.tgCaseClause(); clause.When = this.WhenItem; clause.Then = expression; if (data.Cases == null) { data.Cases = new List <tgSimpleCaseData.tgCaseClause>(); } this.data.Cases.Add(clause); return(this); }
internal tgChar(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Char); }
/// <summary> /// The Constructor /// </summary> public tgCase(tgDynamicQuerySerializable query, tgQueryItem queryItem) { this.data.Query = query; this.data.QueryItem = queryItem; }
internal tgSingle(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Single); }
internal tgInt64(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Int64); }
internal tgDouble(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Double); }
internal tgDecimal(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Decimal); }
internal tgDateTime(tgQueryItem item) { base.item = item; item.Cast(tgCastType.DateTime); }
internal tgByte(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Byte); }
internal tgGuid(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Guid); }
internal tgBoolean(tgQueryItem item) { base.item = item; item.Cast(tgCastType.Boolean); }
internal tgString(tgQueryItem item) { base.item = item; item.Cast(tgCastType.String); }
public tgCase When(tgQueryItem ex) { return(this); }
/// <summary> /// /// </summary> private void AssignProviderMetadata(tgDynamicQuerySerializable query, List <tgDynamicQuerySerializable> beenThere) { if (beenThere.Contains(query)) { return; } beenThere.Add(query); tgDynamicQuery theQuery = query as tgDynamicQuery; IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal; if (theQuery != null) { tgConnection conn = theQuery.tg2.Connection; if (iQuery.ProviderMetadata == null) { tgProviderSpecificMetadata providerMetadata = theQuery.Meta.GetProviderMetadata(conn.ProviderMetadataKey); iQuery.DataID = theQuery.Meta.DataID; iQuery.Columns = theQuery.Meta.Columns; iQuery.ProviderMetadata = providerMetadata; } iQuery.Catalog = conn.Catalog; iQuery.Schema = conn.Schema; } // This code is for proxies as they are unable to work with column and provider metadata // until serialized back to the server if (iQuery.SelectAll) { foreach (tgColumnMetadata col in (tgColumnMetadataCollection)iQuery.Columns) { tgQueryItem item = new tgQueryItem(this, col.Name, col.esType); query.Select(item); } } else { List <tgQueryItem> columns = iQuery.SelectAllExcept; if (columns != null) { foreach (tgColumnMetadata col in (tgColumnMetadataCollection)iQuery.Columns) { bool found = false; for (int i = 0; i < columns.Count; i++) { if (col.Name == (string)columns[i]) { found = true; break; } } if (found) { continue; } tgExpression item = new tgQueryItem(this, col.Name, col.esType); query.Select(item); } } } foreach (tgDynamicQuerySerializable subQuery in iQuery.queries.Values) { AssignProviderMetadata(subQuery, beenThere); } if (iQuery.InternalSetOperations != null) { foreach (tgSetOperation setOperation in iQuery.InternalSetOperations) { AssignProviderMetadata(setOperation.Query, beenThere); } } }