/// <summary> /// Entity property get method. /// </summary> /// <returns>Entity object</returns> public static TEntity Get <TParent>(ref TEntity memberEntity, TParent parentEntity, string propertyName) where TParent : Entity, new() { // If member entity not null return same object. if (memberEntity != null) { return(memberEntity); } // Get property primary key parameter values. object[] newPkparameters = EntityMechanic <TEntity> .GetPrimaryKeyParameters(memberEntity, parentEntity, propertyName); memberEntity = EntityMechanic <TEntity> .GetByPrimaryKey(newPkparameters); return(memberEntity); }
/// <summary> /// Returns single entity object (or null) from database given primary key value. /// </summary> protected static TEntity TryGetByPrimaryKey <TEntity>(params object[] parameters) where TEntity : Entity, new() { return(EntityMechanic <TEntity> .GetByPrimaryKey(parameters)); }