Sign in
Meta-Me
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Options
About
Email Blog Author
RSS for posts
Atom
RSS for comments
OK
Search
Tags
Astoria
C#
Code Only
Community
Data Services
DSP
EDM
EF
EF 4.0
EF Internals
Entity Framework
Expressions
Foreign Keys
Functional
IDataServiceQueryProvider
LINQ
LINQ to Entities
Metadata
Object Services
OData
Philosophical
Ramblings
Samples
Tips
Tricks
Archive
Archives
May 2013
(1)
December 2012
(2)
November 2012
(1)
August 2012
(2)
February 2012
(1)
June 2011
(2)
June 2010
(3)
March 2010
(2)
February 2010
(5)
January 2010
(10)
December 2009
(3)
November 2009
(9)
October 2009
(4)
September 2009
(3)
August 2009
(5)
July 2009
(8)
June 2009
(8)
May 2009
(9)
April 2009
(9)
March 2009
(10)
February 2009
(3)
January 2009
(7)
December 2008
(3)
November 2008
(2)
September 2008
(2)
July 2008
(1)
June 2008
(1)
May 2008
(7)
April 2008
(2)
March 2008
(3)
February 2008
(8)
January 2008
(2)
December 2007
(2)
November 2007
(11)
Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
Meta-Me
OData support in ASP.NET Web API
Posted
10 months ago
by
Alex D James
52
Comments
UPDATE 2 @1:21 pm on 16th August (PST): There is an updated version of the nuget package that resolves the previous dependency issues. Oh and my comments are now working again. UPDATE 1 @10:00 am on 16th August (PST): If you’ve tried using the...
Meta-Me
Tip 23 – How to fake Enums in EF 4
Posted
over 4 years ago
by
Alex D James
51
Comments
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...
Meta-Me
OData in WebAPI – Microsoft ASP.NET Web API OData 0.2.0-alpha release
Posted
7 months ago
by
Alex D James
30
Comments
Since my last set of blog posts on OData support in WebAPI (see parts 1 & 2 ) we’ve been busy adding support for Server Driven Paging, Inheritance and OData Actions. Our latest alpha release on Nuget has preview level support for these features. Lets...
Meta-Me
Tip 8 - How to write 'WHERE IN' style queries using LINQ to Entities
Posted
over 4 years ago
by
Alex D James
28
Comments
Imagine if you have a table of People and you want to retrieve only those whose the Firstname is in a list of interesting firstnames. This is trivial in SQL, you write something like this: SELECT * FROM People WHERE Firstname IN ('Alex', 'Colin', ...
Meta-Me
Tips and Tricks
Posted
over 4 years ago
by
Alex D James
25
Comments
Hopefully if you're reading this you've noticed that I've started a series of Tips recently. The tips will mostly apply to Entity Framework or Data Services. Seeing as I expect to have a lots of tips, it probably makes sense to have some sort of...
Meta-Me
Tip 7 - How to fake Foreign Key Properties in .NET 3.5 SP1
Posted
over 4 years ago
by
Alex D James
22
Comments
Background If you've been reading the EF Design Blog you will have seen that we recently announced something called " FK Associations " for the EF in .NET 4.0. However in .NET 3.5 SP1, we only support Independent Associations. What that means is that...
Meta-Me
Tip 22 - How to make Include really Include
Posted
over 4 years ago
by
Alex D James
22
Comments
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”)...
Meta-Me
Tip 26 – How to avoid database queries using Stub Entities
Posted
over 4 years ago
by
Alex D James
21
Comments
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...
Meta-Me
Tip 28 - How to implement an Eager Loading strategy
Posted
over 4 years ago
by
Alex D James
20
Comments
Background: Over the last 2 years lots of people have complained about the way Eager loading works in the Entity Framework, or rather the way you ask the Entity Framework to eagerly load. Here is how you do it: var results = from b in ctx.Blogs.Include...
Meta-Me
OData in WebAPI – RC release
Posted
6 months ago
by
Alex D James
20
Comments
Next week we will release an official RC of the Microsoft ASP.NET WebAPI OData assembly. This marks the third release on our way to RTM. Although this post talks about code that hasn’t been officially release yet, since all development is happening...
Meta-Me
Tip 34 – How to work with Updatable Views
Posted
over 4 years ago
by
Alex D James
16
Comments
UPDATE: thanks Zeeshan for pointing out that by default only non-nullable columns end up in the key for view backed entities. Imagine this situation, you have a view in your database, and it is updatable. Next you decide to use this view with the Entity...
Meta-Me
Tip 9 – How to delete an object without retrieving it
Posted
over 4 years ago
by
Alex D James
16
Comments
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...
Meta-Me
T CastByExample<T>(object o, T example)
Posted
over 6 years ago
by
Alex D James
15
Comments
So earlier today I was lamenting that an anonymous type can't be shared between functions with Wes Dyer , when he said "Well actually they can..." Cue me learning something cool. The first step is to create a seemingly innocent method: public...
Meta-Me
Why can’t I efficiently compose method calls in SOA?
Posted
over 4 years ago
by
Alex D James
14
Comments
Imagine if you have these 3 methods: public Employee GetEmployee(string alias); public Department GetDepartment(Employee employee); public Employee GetManager(Department department); Now imagine if you want to find the Manager of the Department that some...
Meta-Me
Custom Data Service Providers
Posted
over 3 years ago
by
Alex D James
14
Comments
Introduction Data Services sits above a Data Service Provider, which is responsible for interacting with the underlying Data Source on behalf of the Data Service. Data Services ships with some internal providers, and makes it possible for you to...
Meta-Me
Tip 37 – How to do a Conditional Include
Posted
over 4 years ago
by
Alex D James
13
Comments
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....
Meta-Me
Tip 12 - How to choose an Inheritance Strategy
Posted
over 4 years ago
by
Alex D James
13
Comments
What strategies does the Entity Framework support? The Entity Framework supports 3 primary inheritance strategies: Table Per Hierarchy (TPH): In TPH, all data for a type hierarchy is stored in one table, and there is a discriminator column that is used...
Meta-Me
Tip 13 - How to Attach an Entity the easy way
Posted
over 4 years ago
by
Alex D James
13
Comments
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...
Meta-Me
Tip 14 - How to cache Entity Framework Reference Data
Posted
over 4 years ago
by
Alex D James
13
Comments
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...
Meta-Me
Another C# trick: Fluents, Inheritance and Extension Methods
Posted
over 4 years ago
by
Alex D James
12
Comments
Here’s a scenario which Damien and I encountered recently. We needed a way of specifying Facets for properties on Entities, i.e. things like Nullable , MaxLength , Precision etc. And we needed a class hierarchy because different types of properties...
Meta-Me
Tip 18 – How to decide on a lifetime for your ObjectContext
Posted
over 4 years ago
by
Alex D James
12
Comments
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...
Meta-Me
Tip 30 – How to use a custom database function
Posted
over 4 years ago
by
Alex D James
11
Comments
Imagine you have a database function like the DistanceBetween function in Nerd Dinner : CREATE FUNCTION [dbo].[DistanceBetween]( @Lat1 as real, @Long1 as real, @Lat2 as real, @Long2 as real) RETURNS real AS BEGIN … END And you want to use it...
Meta-Me
Creating a Data Service Provider – Part 6 – Query Interactions
Posted
over 3 years ago
by
Alex D James
11
Comments
Whenever I find myself implementing a series of interfaces to plug into a framework or server, I always find myself wondering how the server will call my implementations. For me this is about forming a mental model to simplify how I think about what...
Meta-Me
Tip 3 - How to get started with T4
Posted
over 4 years ago
by
Alex D James
11
Comments
So if you've been reading the Entity Framework Design Blog you will have heard us talk about T4 . It is a technology that ships with Visual Studio 2008 (and 2005 as a separate download). In .NET 4.0 the Entity Framework is leverage T4 to help with...
Meta-Me
Associations with Payloads
Posted
over 5 years ago
by
Alex D James
10
Comments
Those of you who know what I am talking about will probably also know that we have been saying publicly that the Entity Framework doesn't support them. Now for those who don't know what an association with a payload is, imagine something like: Order...
Page 1 of 7 (151 items)
1
2
3
4
5
»