Welcome to MSDN Blogs Sign in | Join | Help

June 2009 - Posts

New EF blogger – Craig Lee
Short one this time. Craig Lee , a colleague of mine who works on the tools team, has just started blogging. He already has a number of posts, including an interesting one on keyboard shortcuts . Enjoy. Read More...
Tip 26 – How to avoid database queries using Stub Entities
What are Stub Entities? A stub entity is a partially populated entity that stands in for the real thing. For example this: Category c = new Category {ID = 5}; is a stub entity. It has only the ID populated, which indicates this is a stub for Category Read More...
Wrapping Providers
For well over a year now I've been talking about how it is possible with EF to write a provider that sits between the EF and the native database provider. There are lots of reasons why you might do this. Here are some examples, you could write a: Tracing Read More...
Tip 25 – How to Get Entities by key the easy way
Sometimes rather than writing this: var customer = ctx.Customers.First(c => c.ID == 5); You would rather write something like this: var customer = ctx.Customers.GetCustomerById(5); In .NET 4.0 this would be trivial to do by modifying the T4 templates Read More...
Tip 24 – How to get the ObjectContext from an Entity
Customers often ask how to get from an Entity back to the ObjectContext . Now generally we don’t recommend trying this. But sometimes you really need a way to get to the ObjectContext . For example if you are in method and all you have is the Entity, Read More...
Tip 23 – How to fake Enums in EF 4
As of right now Enums are not in EF4. Now we will be listening to your feedback about Beta1, and making some adjustments, so you never know, but at the moment it doesn’t look like they will be supported. Yesterday though I came up with a workaround that, Read More...
Ordering of Commands – What do you think?
Some of our customers write code like this: ctx.AddToCustomers(customer); ctx.AddToProducts(product1); ctx.AddToProducts(product2); And expect the Entity Framework to issue 3 insert commands in the same order. Today the EF doesn’t preserve this sort of Read More...
Tip 22 - How to make Include really Include
This is 22nd post in my ongoing series of Entity Framework Tips . If you want to do eager loading with the Entity Framework it is generally really easy, you simply write something like this: var results = from post in ctx.Posts.Include(“Comments”) where Read More...
Page view tracker