I have an entity which I have configured using the Fluent API. Notice the HasColumnOrder on the properties.
public class SomeEntityMap : EntityTypeConfiguration<SomeEntity>
{
public SomeEntityMap ()
{
// Primary Key
this.HasKey(t => new { t.Id, t.BarId });
this.ToTable("SomeEntity", "Foo");
this.Property(t => t.Id).HasColumnName("Id").HasColumnOrder(0);
this.Property(t => t.BarId).HasColumnName("BarId").HasColumnOrder(1);
// additional properties removed for brevity
}
}
As part of a generic method, I want to be able to find an entity's keys so I can find an entity using
DbSet().Find()
to which I need to pass the primary key values in the correct order.
I can get the key names from the ObjectContext but I cannot see where to get the order. Can anyone help?