Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Foreign Keys   (RSS)
Tip 39 – How to set overlapping Relationships – EF 4.0 only
Scenario: In EF 4 we have FK relationships , available for the first time in .NET 4.0 Beta 2, so it is now possible to have a model something like this: public class Division { public int DivisionID {get;set} // Primary Key public string Name {get;set;} Read More...
Tip 17 – How to do one step updates with AttachAsModified(..)
Background: In Tip 13 - How to Attach the easy way I showed you how to ‘establish’ the EntitySet for a particular CLR Type so you could Attach it. But in all the tips so far the same basic pattern is used: Attach the original version of the Entity Modify Read More...
Tip 11 – How to avoid Relationship Span
Background and Motivation: In my last post on EF Jargon I introduced the concept of Relationship Span. If you remember Relationship Span is basically responsible for compensating for the lack of Foreign Key properties* in your Entity. Relationship Span Read More...
Tip 9 – How to delete an object without retrieving it
Problem The most common way to delete an Entity in the Entity Framework is to pull the Entity you want to delete into the context and then delete it like this: // Find a category by ID by // TRIVIA: in .NET 4.0 you can use .Single() // which will throw Read More...
Page view tracker