Support adding element directly and indirectly to InMemoryDataContext. Previously causes error on commit.