public tgDataResponse esLoadDataTable(tgDataRequest request, tgProviderSignature sig) { request.DatabaseVersion = sig.DatabaseVersion; tgDataResponse response = tgProviderFactory.GetDataProvider(sig.DataProviderName, sig.DataProviderClass).esLoadDataTable(request); if(request.DynamicQuery != null) { request.DynamicQuery.tg.LastQuery = response.LastQuery; } if (response.IsException) { throw response.Exception; } return response; }
/// <summary> /// Execute the Query and loads your BusinessEntity. /// If you need to be notified that this is being called /// override BusinessEntity.Query.OnLoadEvent(). /// </summary> /// <remarks> /// The default conjunction is AND. /// You can change the default conjunction this way: /// <code> /// emps.Query.es.DefaultConjunction = tgConjunction.Or; /// </code> /// </remarks> /// <returns>True if at least one record was loaded</returns> virtual public bool Load() { bool loaded = false; DataTable table = null; FixupSerializedQueries(); tgDataRequest request = new tgDataRequest(); this.PopulateRequest(request); tgDataProvider provider = new tgDataProvider(); tgDataResponse response = provider.esLoadDataTable(request, this.tg2.Connection.ProviderSignature); table = response.Table; if (prefetchMaps != null) { foreach (tgPrefetchMap map in prefetchMaps) { // Give our Prefetch Queries the proper connection strings if (!map.Query.tg2.HasConnection) { string generatedName = this.GetConnectionName(); if (generatedName != null) { // Use the connection name typed into the generated master when they // generated the code map.Query.tg2.Connection.Name = generatedName; } else { // Use the connection from the Collection/Entity at the time they // call Load() map.Query.tg2.Connection.Name = this.connection.Name; } } map.Table = map.Query.LoadDataTable(); } } if (this.OnLoadDelegate != null) { loaded = OnLoadDelegate(this, table); } return(loaded); }