Sign in
Meta-Me
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Tags
.NET 4.0
Architecture
ASP.NET
Associations
Astoria
Authentication
C#
Char
CLR
Code Only
Community
CQRS
Data 2.0
Data Availability
Data Services
Data Services Client
Debugging
Decisions
Design
Designer
DSP
Eager Loading
EDM
EF
EF 3.5
EF 4.0
EF Internals
EF Providers
Entity Framework
Entity SQL
Enums
Escher
Expressions
Extension Methods
FantasySoccer
File Systems
Finds
Fixed Length
Fixup
FK Associations
Fluent APIs
Foreign Keys
Functional
Guidance
Hyperdata
IDataServiceMetadataProvider
IDataServiceQueryProvider
IDataServiceUpdateProvider
Independent Associations
Instincts
Intent
IQueryable
IServiceProvider
JQuery
JSON
Lambda
LazyLoading
Learning
Links
LINQ
LINQ to Entities
Linq to Objects
LINQ to SQL
Mapping
Mental Model
Metadata
Monad
Musings
MVC
NChar
Object Services
ObjectQuery
OData
Optimistic Concurrency
Partial Class
Performance
Philosophical
Pluralization
POCO
Principles
Ramblings
RDF
Reflection Provider
Relationships
REST
Samples
Self-Tracking Entities
Sharepoint
SOA
SOAP
Specifications
SSDL
Statement Expression
StronglyTyped
T4
TechEd2010
Tips
Tricks
Walkthru
WCF
Browse by Tags
MSDN Blogs
>
Meta-Me
>
All Tags
>
object services
Tagged Content List
Blog Post:
Tip 37 – How to do a Conditional Include
Alex D James
Problem Someone asked how to do a Conditional Include a couple of days ago on StackOverflow. They wanted to query for some entity (lets say Movies) and eager load some related items (lets say Reviews) but only if the reviews match some criteria (i.e. Review.Stars == 5). Unfortunately though this isn...
on
12 Oct 2009
Blog Post:
Tip 27 – How to Implement BeforeSave Validation
Alex D James
It is common to want to validate that your entities are ‘valid’ before you save them to the database. A naive form of validation might be to try to ensure that your entities are ‘valid’ before you add them to the context, but this doesn’t help you if you pass through ‘invalid’ states, i.e. as you build...
on
20 Jul 2009
Blog Post:
Tip 26 – How to avoid database queries using Stub Entities
Alex D James
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 5. When are Stub Entities Useful...
on
19 Jun 2009
Blog Post:
Tip 25 – How to Get Entities by key the easy way
Alex D James
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 that do code gen. You would simply...
on
11 Jun 2009
Blog Post:
Tip 24 – How to get the ObjectContext from an Entity
Alex D James
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, and you need the ObjectContext perhaps to do...
on
8 Jun 2009
Blog Post:
Tip 18 – How to decide on a lifetime for your ObjectContext
Alex D James
One of the most common questions we get is how long should an ObjectContext should live. Options often cited include one per: Function Form Thread Application Plenty of people are asking these types of questions, case in point here is a question on Stackflow . I am sure there are many more buried away...
on
7 May 2009
Blog Post:
Tip 17 – How to do one step updates with AttachAsModified(..)
Alex D James
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 it SaveChanges I’ve given you tips to make it...
on
2 May 2009
Blog Post:
Tip 16 – How to mimic .NET 4.0’s ObjectSet<T> today
Alex D James
Background: In order to be an EF power user today you really need to be familiar with EntitySets . For example you need to understand EntitySets in order to use AttachTo(…) or create EntityKeys . In most cases there is only one possible EntitySet for each object / clr type. It is this idea that...
on
1 May 2009
Blog Post:
Tip 14 - How to cache Entity Framework Reference Data
Alex D James
Scenario: In order to make applications perform it makes a lot of sense to cache commonly used reference data. Good examples of reference data include things like States, Countries, Departments etc. Generally you want to have this data readily at hand, so you can populate dropdown boxes etc. A good example...
on
22 Apr 2009
Blog Post:
Tip 13 - How to Attach an Entity the easy way
Alex D James
The Problem: In some of earlier tips we talked about using Attach to load things into the ObjectContext in the unchanged state without wearing the cost of doing a query. Attach is the weapon of choice if performance is your goal. Unfortunately our APIs aren't tailored for the 99% case, which is where...
on
15 Apr 2009
Blog Post:
Tip 6 - How and when to use eager loading
Alex D James
When should you use eager loading? Usually in your application you know what you are going to "do" with an entity once you have retrieved it. For example if you retrieve an order so you can re-print it for a customer, you know that the re-print would be incomplete without information about the items...
on
23 Mar 2009
Page 1 of 1 (11 items)