Q:

Does EF Code First have this Translate method?

I haven't seen it anywhere, but I'm wondering if Code First has an implementation of the Translate method described here. I'm currently using the Materialize method used in the EFExtensions project (modified for use with Code First), but I assume this method has these benefits:

Probably knows what to do with complex types based on mappings instead of making assumptions off of property names.
Probably returns the object proxies instead of the actual T specified.

Does anyone know enough about this method to comment on my assumptions, and does anyone know if this is available with Code First?

A:

Just tried it. This example is in C#
using(YourDbContext ctx = new YourDbContext()) {
  ObjectContext x = ((IObjectContextAdapter)ctx).ObjectContext;

  var conn = ctx.Database.Connection;

  conn.Open();

  using (IDbCommand cmd = conn.CreateCommand())
  {
    cmd.CommandText = "select * from YourType_Table";
    using (DbDataReader reader = (DbDataReader)cmd.ExecuteReader())
    {
      YourType[] result = x.Translate<YourType>(reader).ToArray();
      Console.WriteLine(result.Length);
    }
  }
}

Regarding your questions:

Only primitive types supported. For complex types it throws an InvalidOperationException.
The objects returned are of proxy type.

