Exemple #1
0
            ExecuteStoredProcedure <T1, T2, T3, T4, T5, T6, T7, T8>(string procedureName, ParameterSet parameters, ParameterSet outputParameters, out int returnValue)
                where T1 : CommerceEntity, new()
                where T2 : CommerceEntity, new()
                where T3 : CommerceEntity, new()
                where T4 : CommerceEntity, new()
                where T5 : CommerceEntity, new()
                where T6 : CommerceEntity, new()
                where T7 : CommerceEntity, new()
                where T8 : CommerceEntity, new()
            {
                ReadOnlyCollection <T1> resultThe1st = null;
                ReadOnlyCollection <T2> resultThe2nd = null;
                ReadOnlyCollection <T3> resultThe3rd = null;
                ReadOnlyCollection <T4> resultThe4th = null;
                ReadOnlyCollection <T5> resultThe5th = null;
                ReadOnlyCollection <T6> resultThe6th = null;
                ReadOnlyCollection <T7> resultThe7th = null;
                ReadOnlyCollection <T8> resultThe8th = null;

                Action <IDatabaseResult> populateEntitiesCallback = (databaseResult) =>
                {
                    using (EntityReader reader = new EntityReader(
                               databaseResult,
                               this.RequestContext.GetChannelConfiguration() == null ? null : this.RequestContext.GetChannelConfiguration().TimeZoneRecords))
                    {
                        resultThe1st = reader.ReadNextEntityPagedResult <T1>(PagingInfo.AllRecords).Results;
                        resultThe2nd = reader.ReadNextEntityPagedResult <T2>(PagingInfo.AllRecords).Results;
                        resultThe3rd = reader.ReadNextEntityPagedResult <T3>(PagingInfo.AllRecords).Results;
                        resultThe4th = reader.ReadNextEntityPagedResult <T4>(PagingInfo.AllRecords).Results;
                        resultThe5th = reader.ReadNextEntityPagedResult <T5>(PagingInfo.AllRecords).Results;
                        resultThe6th = reader.ReadNextEntityPagedResult <T6>(PagingInfo.AllRecords).Results;
                        resultThe7th = reader.ReadNextEntityPagedResult <T7>(PagingInfo.AllRecords).Results;
                        resultThe8th = reader.ReadNextEntityPagedResult <T8>(PagingInfo.AllRecords).Results;
                    }
                };

                this.ExecuteStoredProcedure(
                    procedureName,
                    parameters,
                    outputParameters,
                    populateEntitiesCallback,
                    out returnValue);

                var rest           = Tuple.Create(resultThe8th.AsReadOnly());
                var resultDataSets = new Tuple <PagedResult <T1>, ReadOnlyCollection <T2>, ReadOnlyCollection <T3>, ReadOnlyCollection <T4>, ReadOnlyCollection <T5>, ReadOnlyCollection <T6>, ReadOnlyCollection <T7>, Tuple <ReadOnlyCollection <T8> > >(
                    this.settings == null ? resultThe1st.AsPagedResult() : new PagedResult <T1>(resultThe1st, this.settings.Paging),
                    resultThe2nd.AsReadOnly(),
                    resultThe3rd.AsReadOnly(),
                    resultThe4th.AsReadOnly(),
                    resultThe5th.AsReadOnly(),
                    resultThe6th.AsReadOnly(),
                    resultThe7th.AsReadOnly(),
                    rest);

                return(resultDataSets);
            }