none
How use MergeOption in EF 4.1? RRS feed

All replies

  • Hello,

    you cannot use MergeOption with DbContext API. The only available replacement is AsNoTracking extension method for IQueryable with the same meaning as MergeOption.NoTracking. If you want full power of MergeOption you must convert your DbContext to ObjectContext and use ObejctSet and ObjectQuery instead:

    ObjectContext context = ((IObjectContextAdapter)dbContext).ObjectContext;
    ObjectSet<YourEntity> set = objectContext.CreateObjectSet<YourEntity>();
    set.MergeOption = ...;
    // Now run the query from the set
    

    Best regards,
    Ladislav

    Wednesday, August 31, 2011 1:04 PM
  • Hi, Thanks, I would like to mark you answered but can't see any option.
    Saturday, September 10, 2011 5:09 PM
  • You can't because you started this topic as discussion and not a question.

    Best regards,
    Ladislav

    Monday, September 12, 2011 12:29 PM