Parallel programming in .net.

 Collection<DataSet> comms = new Collection<DataSet>();
                     var sp1 = new Action(() =>
                           {comms = MarketingWebsitesDataManager.GetMarketingCommunities(BuilderCode, 1);
                           }
                           );
List<IAttachment> Attachmentsnew = new List<IAttachment>();
                     var sp2 = new Action(() =>
                           {
                                  Attachmentsnew = MarketingWebsitesDataManager.GetMarketingProductAttachmentsReader(BuilderCode, 1);
                           }
                     );

System.Threading.Tasks.Parallel.Invoke(sp1, sp2);

Both of these methods will be called at the same time. This will improve performance. 

Can be used if the param we are passing to method 2 is not getting changed in method 1.

or if the returned data from method 1 is not used in method 2 then we can use this.

This is part of .net 4.0


Concepts to remember. 


1) Sql is faster in getting the data.

2) .net is faster in processing the data.

3) When you select the data from the db. No of columns and rows matter because the size of the data getting transferred or read from the disk varies if the data is big.

4)It is better to convert the data from the reader to Bo than putting the value in a dataset and then converting it into Bo.


Comments (2) -

바카라

With thanks! Valuable information!

바카라

I got what you mean,saved to fav, very decent site.

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading