This quick start guide summarizes the major changes when moving from DevForce 2010 to DevForce 2012. For more detailed information, see the Migration Details topic.
Like Microsoft's Entity Framework, DevForce 2012 has made the leap to NuGet. Instead of running a global DevForce installer, you now use NuGet to add a DevForce package to your project. NuGet will resolve all dependencies and automatically adds all the libraries and references that you'll need. For more details, see Installing DevForce 2012.
DevForce 2012 introduces the use of the Task-based Asynchronous Pattern (TAP). Many of you will have heard of this as being able to use the await keyword, which makes asynchronous method calls feel synchronous when you're writing code. So, instead of writing callbacks, lambda expressions, or coroutines, you now use await. To illustrate the difference, here's an example.
Using a lambda expression in DevForce 2010:
C# | void MainPage_Loaded(object sender, RoutedEventArgs e) { var mgr = new NorthwindIBEntities(); mgr.Employees.ExecuteAsync(op => { var emps = op.Results; }); ... } |
Using await in DevForce 2012:
C# | async void MainPage_Loaded(object sender, RoutedEventArgs e) { var mgr = new NorthwindIBEntities(); var emps = await mgr.Employees.ExecuteAsync(); ... } |
Error handling is also more convenient with await. Instead of checking each operation to see if there was an error, you can perform multiple asynchronous tasks inside a single try / catch block. This makes code easier to read and removes a lot of redundant error handling code.
Because the new asynchronous queries return results directly, they no longer return an EntityQueryOperation. If you'd like additional information about a query result, you should call TryExecuteQuery or TryExecuteQueryAsync. The QueryResult has the information which used to be on the EntityQueryOperation (like WasFetched, ChangedEntities, etc).
See Query asynchronously to learn more about queries, QueryResults, Tasks, and exception handling.
The SaveChanges / SaveChangesAsync API has also changed. A SaveResult is not returned by default. To obtain a SaveResult, call TrySaveChanges or TrySaveChangesAsync.
See Perform a save to learn more about the Save API.
Partial saves are no longer supported. A partial save is the ability to save a specific subset of the entities in cache. We have long advised against using this feature which is rarely needed in practice. We found over the years that developers tended to omit an essential related entity by accident with consequent failures of data integrity.
We have removed partial saves from DevForce 2012, hoping to steer developers away from trouble. Developers should consider implementing a Unit of Work pattern instead.
If you must perform partial saves, you can still achieve this effect by importing the selected entities into a separate EntityManager and calling SaveChanges on that manager. If there is sufficient demand, we could add partial saves to the Compatibility Assembly (see below). Let us know.
If you would like to perform the migration to DevForce 2012 in phases, you can still access most of the old DevForce 2010 API by using NuGet to install the "DevForce 2012 Compatibility Pack". This adds a reference to IdeaBlade.EntityModel.Compat (or IdeaBlade.EntityModel.Compat.SL). See Using the DevForce 2012 Compatibility Pack for more information.
Cocktail also has a compatibility pack to support your migration. See Migrating from Cocktail v1.0.x for more information.
All customers who have active DevForce 2010 subscriptions will be able to upgrade to DevForce 2012 for free. Just enter your existing DevForce 2010 key when asked during installation.
Classes/methods marked obsolete or "for internal use only" in DevForce 2010 have been removed in DevForce 2012 including:
If you are using any obsolete classes/methods, consider moving to the current API in DevForce 2010 before migrating to DevForce 2012. For a more comprehensive list of changes, please see the release notes.