Linq to Open Access update multiple columns without assigning every column

Thread is closed for posting
2 posts, 0 answers
  1. Ian Turvey
    Ian Turvey avatar
    2 posts
    Member since:
    Jun 2009

    Posted 09 Aug 2012 Link to this post

    Hi is there a way to update multiple columns without assigning values from one object to another

    product.Name = pro.Name;

    If you have around 50 columns then it's quite annoying in Linq2Sql you can do something like this


     public Product UpdateRecord(Product pro)
          if (pro.ProductID > 0)       //means you have id so go for update
             // get the existing record in a different method
               Product  PreviousRecord = Original_ByID(pro.ProductID);

               // Now time to change the existing record with new record passed in parameter
              var dal = new DALEntityModel();
              dal.Products.Attach(pro, PreviousRecord);

     public static Inventory Original_ByID(Int32 proId)
           var dal = new DALEntityModel ();
           return (from p in dal.Products
                           where p.ProductId == proId
                           select p).Single();



    Is there a way to do this on open access


  2. Ivailo
    Ivailo avatar
    318 posts

    Posted 14 Aug 2012 Link to this post

    Hi Ian,

    A similar functionality for attaching persistent entities is offered by OpenAccess ORM as well. You can find more details in the Attach/Detach functionality article.

    I hope that helps. Let us know if you have any other questions.

    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Back to Top