Blog - About

About Meta-Me

Hi,

My name is Alex James, a Program Manager working on the Data Services team at Microsoft.

My current focus is OData and improving the usability of Data Services, both client and server side.

Previously I worked on the Entity Framework team where I helped create EF 4.0, and CodeOnly.

I'm also really passionate about Metadata, hence the name Meta-me.

Cheers
Alex

I waffle and twitter as adjames

  • Meta-Me

    Tip 31 – How to compose L2O and L2E queries

    • 2 Comments
    Imagine you want to write a query like this: var possibleBuyers= from p in ctx.People where p.Address.City == “Sammamish” && InMarketForAHouse(p) select p; Now theoretically this is possible so long as there is a SQL translation for InMarketForAHouse...
  • Meta-Me

    Tip 30 – How to use a custom database function

    • 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

    Another C# trick: Fluents, Inheritance and Extension Methods

    • 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 29 – How to avoid LazyLoad or Load() reader issues

    • 1 Comments
    If you have code that looks like this: var results = from c in ctx.Customers where c.SalesPerson.EmailAddress == “…” select c; foreach(var customer in results) { Console.WriteLine(customer.Name); if (IsInteresting(customer)) { customer.Orders.Load...
  • Meta-Me

    Some comments on efficient SOA method composition

    • 2 Comments
    A couple of posts back I started talking about composing SOAPY operations efficiently, by shipping intent to the service. An interesting debate ensued in my comments: Kristofer (the guy behind the Huagati tools for DBML and EDMX , and it seems a man after...
  • Meta-Me

    And while you are at it… why can’t I compose REST calls?

    • 0 Comments
    In my last post I asked why you can’t compose SOA method calls efficiently. With REST services like ADO.NET Data Services having nice uniform URLs too, and a model (aka EDM) why can’t I compose those with my SOA methods too: i.e. expounding on my...
  • Meta-Me

    Why can’t I efficiently compose method calls in SOA?

    • 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

    Tip 28 - How to implement an Eager Loading strategy

    • 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

    A silly C# trick from the trenches

    • 7 Comments
    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...
  • Meta-Me

    I never knew: C# method overloads can return different types

    • 4 Comments
    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...
  • Meta-Me

    Tip 27 – How to Implement BeforeSave Validation

    • 4 Comments
    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...
  • Meta-Me

    New EF blogger – Craig Lee

    • 0 Comments
    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.
  • Meta-Me

    Tip 26 – How to avoid database queries using Stub Entities

    • 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

    Wrapping Providers

    • 1 Comments
    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...
  • Meta-Me

    Tip 25 – How to Get Entities by key the easy way

    • 5 Comments
    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...
  • Meta-Me

    Tip 24 – How to get the ObjectContext from an Entity

    • 7 Comments
    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...
  • Meta-Me

    Tip 23 – How to fake Enums in EF 4

    • 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

    Ordering of Commands – What do you think?

    • 5 Comments
    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...
  • Meta-Me

    Tip 22 - How to make Include really Include

    • 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

    An enumeration of one?

    • 1 Comments
    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...
  • Meta-Me

    Learn about EF Pluralization Services courtesy of Dan Rigsby

    • 1 Comments
    Not long ago I wrote a ‘sneak peek’ for our new Pluralization features on the ADO.NET team blog. There is a more indepth post coming soon… But it seems the community is starting to do our education for us, and beating us (or should I say me) to the punch...
  • Meta-Me

    Tip 21 – How to use the Single() operator – EF 4.0 only

    • 3 Comments
    This is 21st post in my ongoing series of Entity Framework Tips , and the first that is specific to EF 4.0. Entity Framework 4.0 Beta 1 As you’ve probably heard VS 2010 Beta 1 is now available to subscribers which means some of you can get your hands...
  • Meta-Me

    Tip 20 – How to deal with Fixed Length Keys

    • 6 Comments
    This is 20th post in my ongoing series of Entity Framework Tips . Fixed Length Field Padding: If you have an fixed length column in the database, for example something like NCHAR(10) when you do an insert, padding happens automatically. So for example...
  • Meta-Me

    Tip 19 – How to use Optimistic Concurrency with the Entity Framework

    • 9 Comments
    This is the 19th post in my ongoing series of Entity Framework Tips . Background: If you have a table with a timestamp column, and you reverse engineer an Entity from that table, you will end up with a Binary property in your entity (in my example...
  • Meta-Me

    Tip 18 – How to decide on a lifetime for your ObjectContext

    • 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...
Page 3 of 7 (151 items) 12345»