C# Class Brass9.Data.Entity.EFMetaHelper

Show file Open project: b9chris/Brass9.Data

Public Methods

Method Description
GetKey ( object o, DbContext db ) : object

Ambitiously assumes the passed in object is an Entity, and there's exactly one key on the model. Returns the value of that key.

GetKeysForModel ( object o, DbContext db ) : IEnumerable

Gets the Keys for a given Entity model, as PropertyInfo objects

GetKeysForModelType ( Type type, DbContext db ) : IEnumerable

Gets the keys for a given Entity model Type, as PropertyInfo objects Extracted from EF GraphDiff, RefactorThis.GraphDiff.Internal.Extensions.GetPrimaryKeyFieldsFor

ObjectContextForDb ( DbContext db ) : ObjectContext

Gets the hidden ObjectContext that backs this DbContext. http://social.msdn.microsoft.com/Forums/en-US/0c1f8425-55f4-4600-9605-a925220d5a25/objectcontext-from-dbcontext?forum=adonetefx

Method Details

GetKey() public static method

Ambitiously assumes the passed in object is an Entity, and there's exactly one key on the model. Returns the value of that key.
public static GetKey ( object o, DbContext db ) : object
o object
db DbContext
return object

GetKeysForModel() public static method

Gets the Keys for a given Entity model, as PropertyInfo objects
public static GetKeysForModel ( object o, DbContext db ) : IEnumerable
o object
db DbContext
return IEnumerable

GetKeysForModelType() public static method

Gets the keys for a given Entity model Type, as PropertyInfo objects Extracted from EF GraphDiff, RefactorThis.GraphDiff.Internal.Extensions.GetPrimaryKeyFieldsFor
public static GetKeysForModelType ( Type type, DbContext db ) : IEnumerable
type Type
db DbContext
return IEnumerable

ObjectContextForDb() public static method

Gets the hidden ObjectContext that backs this DbContext. http://social.msdn.microsoft.com/Forums/en-US/0c1f8425-55f4-4600-9605-a925220d5a25/objectcontext-from-dbcontext?forum=adonetefx
public static ObjectContextForDb ( DbContext db ) : ObjectContext
db DbContext
return ObjectContext