When an XAF application uses the Entity Framework as an ORM layer, an Object Space of the EFObjectSpace class is created. This class is a wrapper over the ObjectContext, which is a container for in-memory objects in the Entity Framework. To access the Object Context used by the current Object Space, use the EFObjectSpace.ObjectContext property. The Object Space uses its Object Context to create, manage and delete persistent objects.
The Object Context's ObjectStateManager tracks every change to every simple property of a persistent object. All the changes are automatically saved to the database by making a single call of the ObjectContext.SaveChanges method, which the Object Space performs using the BaseObjectSpace.CommitChanges method. For details, refer to the Entity Framework documentation. To be sure that changes made to a persistent object's reference properties are tracked, call the BaseObjectSpace.SetModified method after you change such properties in code.
EFObjectSpace works with collections of the DevExpress.ExpressApp.EF.EFCollection type when it is required to load all required objects to a client at once, and with the DevExpress.ExpressApp.EF.EFServerCollection collection type when loading objects in small portions on demand.
When you need to create a new Object Space, use the XafApplication.CreateObjectSpace method. It will create an Object Space of the EFObjectSpace type, if the default Object Space Provider is of the EFObjectSpaceProvider type (see the CreateDefaultObjectSpaceProvider method implementation of your WinApplication descendant in your application).
To learn more about Object Spaces, refer to the BaseObjectSpace class description.