I am using the entity framework and I\'m having a problem with \"re-finding\" objects I just created... basically it goes like this:
string theId = \"someId
I was in the same situation. I wrote this extension method that at least for me solves the problem (I don't have issues with i.e conflicts in my context...)
public static IEnumerable WhereInclAdded(this ObjectSet set, Expression> predicate) where T : class
{
var dbResult = set.Where(predicate);
var offlineResult = set.Context.ObjectStateManager.GetObjectStateEntries(EntityState.Added).Select(entry => entry.Entity).OfType().Where(predicate.Compile());
return offlineResult.Union(dbResult);
}