You need to create your entities using DbSet.Create()
when using proxy entities (the default setting).
Entity Framework Code First will create new classes at runtime that inherit from your model classes. So you're not working with your Order
class, but one that inherits from it. This new implementation will override your virtual navigation properties to implement additional features (such as lazy loading).
The specific feature you require here is to notice when the collection has changed. Your class does not provide any features like this (and should not), but the proxy class does.
Now when you new Class()
your model object, it will be exactly your object. It won't be the proxy entity and therefor won't have the additional features. DbSet.Create()
on the other hand will return the proxy entity, upcasted to your class, so you're working with the proxy.