locked
What is the efficient way to Copy properties of source object to destination object in batches (Linq) RRS feed

  • Question

  • User-222276809 posted

    Below is my case:
    I have a dictionary of 1000 items as ProductDict<Upc1, Upc2> where Upc1 and Upc2 are strings which are different records in Product table. I am trying to copy properties from one object to another which are of same type. 

    I don't want to do as below:
    a. For loop for 1000 items
    b. Linq select query to get product object for Upc1
    c. Linq select query to Get product object for Upc2
    d. Copy attributes from Upc2 to Upc1

    Also the dictionary is one-to-one like object 'A' has to be copied to 'A1' and B to 'B1' and etc. Is there any better way to do it batches? I am using Linq sql queries.

    Friday, February 2, 2018 9:37 PM

All replies

  • User1400794712 posted

    Hi praveen_katta,

    I am trying to copy properties from one object to another which are of same type. 

    I'm not clear about your requirement, could you please explain in detail or give an example here?

    I don't want to do as below:
    a. For loop for 1000 items
    b. Linq select query to get product object for Upc1
    c. Linq select query to Get product object for Upc2
    d. Copy attributes from Upc2 to Upc1

    Why do you don't want this? Will it cause any problem? If you can post more details, I can understand your problem better.

    Best Regards,

    Daisy

    Wednesday, February 7, 2018 2:26 AM