I\'m working on an EF 5 Code-First solution and I am trying to update an existing entity with a modified one using the Repository pattern:
public void Up
Ah, the glories of LINQ (and using):
public List GetNavigationProperties(T entity)
{
var t = entity.GetType();
var elementType = ((IObjectContextAdapter)context).ObjectContext.CreateObjectSet().EntitySet.ElementType;
return elementType.NavigationProperties.Select(np => entityType.GetProperty(np.Name)).ToList();
}
This can also be implemented via a static method, with the following signature:
public static List GetNavigationProperties(DbContext context)
{
var t = typeof(T);
...