Tiraggo.Interfaces.tgDataProvider.esLoadDataTable C# (CSharp) Method

esLoadDataTable() public method

Used to populate an esEntity or tgEntityCollection with data.
public esLoadDataTable ( tgDataRequest request, tgProviderSignature sig ) : tgDataResponse
request tgDataRequest Contains all of the information necessary to issue and carry out the request
sig tgProviderSignature Contains the required information to locate the EntitySpaces DataProvider
return tgDataResponse
        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;
        }

Usage Example

Example #1
0
        /// <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);
        }
All Usage Examples Of Tiraggo.Interfaces.tgDataProvider::esLoadDataTable