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
>
c#
Tagged Content List
Blog Post:
Tip 55 - How to extend an IQueryable by wrapping it.
Alex D James
Over the last couple of years I’ve found myself in lots of situations where I’ve wanted to get ‘under the hood’ and see what is happening inside an IQueryable, but I haven’t had an easy solution, at least until now. Getting down and dirty like this is interesting because it means you can: Log...
on
1 Mar 2010
Blog Post:
Tip 54 – How to improve performance using Statement Expressions
Alex D James
Background: While writing the update post in my Data Service Provider series I ended up writing this block of reflection code to copy properties values from one object to another: foreach (var prop in resourceType .Properties .Where(p => (p.Kind & ResourcePropertyKind.Key) != ResourcePropertyKind...
on
13 Feb 2010
Blog Post:
Tip 36 – How to Construct by Query
Alex D James
While writing my tips series and writing EF controllers for MVC I found that I regularly wanted to create and attach a stub entity . Unfortunately it isn’t quite that simple, you have to make sure the entity isn’t already attached first, otherwise you’ll see some nasty exceptions. To avoid these exceptions...
on
23 Sep 2009
Blog Post:
Another C# trick: Fluents, Inheritance and Extension Methods
Alex D James
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 have different sets of available facets. The...
on
31 Jul 2009
Blog Post:
A silly C# trick from the trenches
Alex D James
UPDATE: as Joe rightly points out in the comments (thanks Joe) when you try to pass a Func<T,V> to a method expecting Action<T> using lambda syntax it doesn't fail. Somehow the compiler must realize there is no match for Func<T,V> and look for a match for with Action<T> as a parameter...
on
24 Jul 2009
Blog Post:
I never knew: C# method overloads can return different types
Alex D James
I came to C# from Java, which I’m pretty sure doesn’t (or maybe didn't) allow this, so I was super surprised today when I learnt that C# method overloads can have different return types. So this class is completely valid: public class Foo { public Foo Bar(); public string Bar(Foo foo); } For...
on
22 Jul 2009
Blog Post:
An enumeration of one?
Alex D James
Having something enumerable is the gateway to all LINQ’s loveliness. But sometimes you have just one object. So how do you make that enumerable? var people = new Person[] {person}; Not exactly hard huh? In fact you can simplify this even more, you can replace new T[] with just new [] like this: var people...
on
28 May 2009
Blog Post:
LINQ to Objects and Buffer<T>
Alex D James
I was debugging a problem a couple of days ago, when I learned something interesting. I had some code that looked like this: foreach(Employee e in manager.Manages) { … } The manager.Manages property returned a custom implementation of ICollection<Employee> that lazy-loads it’s data from somewhere...
on
21 Jan 2009
Blog Post:
Sample Oracle Provider for EF
Alex D James
Jarek has released his sample provider for Oracle here . In his post he talks about a few of the more notable challenges he had and how he got around them. If you are writing an EF provider this is gold!
on
23 Jun 2008
Blog Post:
Fantasy Soccer - part 3 - Unit of Measure
Alex D James
Today I spent a bit of time working on the data model for my fantasy soccer application. I don't want to talk about the actual model today though, because I'm not really ready. What I want to do is talk about a problem that occurred to me, namely Unit Of Measure. Any real sport fan knows you...
on
2 May 2008
Blog Post:
Intellisense : What properties are required?
Alex D James
Yesterday I was talking to a Simon, another super smart dev on the EF team, and he raised a big concern, one that I am sure you can all relate too: We've all seen something like this: And thought: "What is the bare minimum I can do here to save a Whatever ?" This "What properties are required...
on
9 Apr 2008
Blog Post:
Maybe there is more
Alex D James
Michel Perfetti , has taken my little Maybe thingie and gone a lot further , by using expression tree re-writting he has made it possible to express this: string code = licensePlate.Maybe(lp => lp.Car) .Maybe(c => c.Owner) .Maybe(o => o.Address) .Maybe(a => a.PostCode); which is...
on
3 Mar 2008
Blog Post:
Maybe I'm just a little slow...
Alex D James
But I only just realized that extension methods are cool for avoiding NullReferenceExceptions . We all know that if you have something like this: LicensePlate licensePlate = null ; Car car = licensePlate.Car; It will throw a NullReferenceException . However if you have an extension...
on
28 Feb 2008
Blog Post:
Rolling your own SQL Update on top of the Entity Framework - Part 4
Alex D James
Okay so we've got to the interesting bit at last. We've hooked up our extension method, we've got a query for filtering the records we are updating, we've got a map from object Properties to database Columns. So now comes the interesting bit... We now have to build the UPDATE [Table] SET Column...
on
11 Feb 2008
Blog Post:
Rolling your own SQL Update on-top of the Entity Framework - Part 3
Alex D James
Okay, okay, okay... yes I know this is the slowest moving series in the history of blogging (sorry Roger J). Now, when a blog post starts like that, you would probably expect the next sentence to begin with "But" or "However", not this time though, I have no excuse, I will simply make an appeal to...
on
11 Feb 2008
Blog Post:
LINQ to non-enumerable?
Alex D James
So I was reading Wes' latest post about Monad's a while back (which incidentally is well worth a read, it is the first good explanation of Monad 's I've seen that uses a language I am comfortable with in it's examples, namely C#). Well one thing Wes kind of brushes over is the fact that he ends up...
on
15 Jan 2008
Blog Post:
Rolling your own SQL Update on top of the Entity Framework - Part 2
Alex D James
Okay so it has taken me a while to get to the second part of this post... but as they say better late than never. As I've said before when designing this sort of API, I always like to start with the end in mind... this is what I want the Update() method to look like: public static int Update<T>...
on
15 Jan 2008
Blog Post:
Rolling your own SQL Update on-top of the Entity Framework - Part 1
Alex D James
One of the current limitations of the Entity Framework, is that in order to modify an entity you have to first bring it into memory. Now in most scenarios this is just fine. There are however some bulk update cases where performance suffers somewhat. For example imagine if you need to move all unshipped...
on
7 Dec 2007
Blog Post:
ObjectQuery<T>.ToTraceString() and possibilities...
Alex D James
So in Beta3 of the EntityFramework (due out very soon) the team added a new function to ObjectQuery <T> that allows you to get the native Query that would be evaluated if you enumerated. I.e. if you are using the System.Data.SqlClient that would be the TSQL. This is very handy because it means...
on
4 Dec 2007
Blog Post:
Hydrating a DataTable from an EntityDataReader - Part 2
Alex D James
See yesterday's post for some context... So we can't rely on EntityDataReader . GetSchemaTable() and a DataAdapter to do the filling of our DataTable for us. We have to do it ourselves. As with any problem the first step is to define the steps: Get a DataTable with a shape that matches the...
on
28 Nov 2007
Blog Post:
T CastByExample<T>(object o, T example)
Alex D James
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 static T CastByExample<T>( this object o, T...
on
22 Nov 2007
Page 1 of 1 (21 items)