To continue on the path that the topic set, I could say “mission successful”, the seminar were crowded in both Stockholm and Malmö. That will be the end of word play for this post.
Thank you all for coming!
The slides and demos where targeted at the beta 1 of .net framework 4.0 and Visual Studio 2010. I mentioned some changes in beta 2, but I will list some of the most important changes in this post.
1. DeferredLoadingEnabled is now LazyLoadingEnabled and is true by default.
2. Relation fixup for non ChangeTrackingProxies will fix relations on DetectChanges and SaveChanges.
For more information about changes and new features in beta 2 head over to the beta 2 announcement post at the ado.net team blog.
The source code for the POCO samples is updated for beta 2. Due to that LazyLoading was off by default, I turn that off in the setup of the tests in IntergationTests folder to change as little as possible from the shown code.
1: [TestInitialize]
2: public void SetUp()
3: {
4: this.context = new PizzaStore.Data.PizzaStoreContext();
5: this.context.ContextOptions.LazyLoadingEnabled = false;
6:
7: }
The test regarding adding/removing a topping for a pizza using the custom AddTopping/RemoveTopping methods could be changed to Add and remove on the collection due to the Relation fixup change in beta2. The relation would be fixed on DetectChanges and SubmitChanges.
*Note* Code like this will not work without the custom methods (AddTopping/RemoveTopping).
1: //This test will not pass, due to that the relation is fixed when DetectChanges or SaveChanges are called.
2: pizza.Toppings.Add(topping);
3: Assert.AreEqual(1, topping.Pizzas.Count);
Download presentation slides:
*Note* In the “post beta 1” slide DataContractResolver is listed. I found no direct help added for usage in beta 2. But more information about how to use DataContractResolver could be found in this Getting the actual object from a proxy forum post.
Download POCO sample code:
*Note* the samples using the Entity Framework features CTP is not included due to that the features package for beta 2 is not released yet.
Screencast
I demoed some new features of the designer. If you would like to see more of this, please visit this Screencast – What’s new in the Entity Data Model Designer in VS2010 (using beta 2) by Julie Lerman.
See you on our next seminar!