Passing Filtered CustomerIDS from client side to Server side fast RRS feed

  • Question

  • I am filtering Contacts using 

    I am looking for the correct but easy way to pass the returned(Filtered Customers) which are displayed on Client's Screen in a paged list, to Server Side for a long running operation (e.g emailing etc).

    For the long running operation I will be using the WEBAPI commanding using the methodology described here ( http://blog.pragmaswitch.com/?p=765 )

    One thought is to loop through all filtered Contacts, built a comma separated string "s" with the Filtered contact ids, and pass that value to webapi commanding. But what happens if we are talking for 50 000 contacts so too many pages and big string?

    Thank you!

                int pageCount = this.Details.Properties.ContactsFilter.PageCount;
                string s = "";
                int pageNumber = 1;
                for (var index = 1; index <= pageCount; index++)
                    this.Details.Properties.ContactsFilter.PageNumber = pageNumber;
                    pageNumber = pageNumber + 1;
                    foreach (Contact p in ContactsFilter)
                        s = s + p.Id.ToString() + ",";
                    s = s.Remove(s.Length - 1, 1);
                //this.Details.Properties.ContactsFilter.PageNumber = 1;

    • Edited by tsiakk Wednesday, April 9, 2014 8:06 AM
    Wednesday, April 9, 2014 8:05 AM


All replies

  • I  wonder whether LightSwitch is appropriate to send. 50,000 or more emails It is better that you use LightSwitch client for selecting records and sent mails with a background process as a Stored procedure call


    Wednesday, April 9, 2014 9:11 AM
  • Bad idea, I'm sorry.

    LightSwitch is meant for OLTP (online transaction processing) applications.

    Let's call the operations you want to a JOB. (e.g. bulk mailing).

    Design a Job table, which has a many 2 many relationship with contacts. (in a next step, you could make this a bit more loosely coupled, in such a way a job can be linked to any entity type, but leave that for now)

    Fill the join table with the 50.000 records. You have already a mechanism client side to identify the contacts.

    Don't launch the actual job on the LightSwitch server. Use a batch job (e.g. azure worker process), to check every now and then, if there is a new job in the job table and let it do the work, i.e. start mail bombing.

    paul van bladel

    Thursday, April 10, 2014 6:36 AM
    • Marked as answer by Angie Xu Wednesday, April 16, 2014 7:39 AM
    Thursday, April 10, 2014 4:38 PM