EF7 - New Platforms, New Data Stores
More detailed information about this effort is available on our team blog
Entity Framework (EF) is now a common data access technology for traditional client and server applications (WPF, WinForms, MVC, WebAPI, WebForms, WCF, etc.). We think there is value in providing the same programming model for data access on the remaining
platforms where .NET development is common (primarily Windows Store and Windows Phone apps). This is especially true in areas where there is currently no good higher level framework for data access – as is the case with Windows Store.
We’ve hit a number of issues as we have looked at taking changes to our code base to allow it to be used on these platforms:
- The EF code base has a long history going back to the WinFS days. It makes extensive use of older APIs and design patterns. It would be very expensive to pull all of this forward onto modern platforms.
- While using less resources is desirable on all platforms it becomes more prominent on devices as they typically have fewer resources than desktop and server machines. EF was not built with this in mind. In particular, memory usage was not a driving factor
when EF was designed and implemented. The current resource usage of EF hinders its ability to be a good data access offering on devices. We’ve done some investigation on lowering resource usage and found it to require architectural changes that require
a very large amount of work.
How this ties into the Cloud
Interestingly, the desire to reduce resource usage is also prominent as we move to cloud computing – especially in ‘Platform as a Service’ (Paas) scenarios. In a pay-per-play cloud environment the cost of running an application is closely
associated with the amount of resources used by that application. This makes it especially important for applications running in the cloud to use fewer resources in order to correspondingly reduce costs.
EF currently uses a significant amount of resources, even for small models and simple data access. This doesn’t align well with a pay-per-play environment.
What are we doing
We are looking at providing a lighter weight version of EF that can be used across a wide variety of platforms. This effort is not about re-implementing the entire EF stack; the current stack contains a lot of APIs and features that are not especially useful
and/or hardly ever used. The lighter weight version will be simplified so that it doesn’t contain these. Some examples of this simplification include just having the DbContext API (no ObjectContext API) and supporting a reduced set of mapping patterns.
Windows Store and Windows Phone
For Store and Phone applications we are initially just looking at local data access. SQLite is by far the most common database choice on devices so we will use that as the default database provider. We will continue to use a provider model though, so other
database providers can be used.
In the future, things such as remote data access and online/offline syncing are areas we may look into. They are not part of our initial investigation though.