예제 #1
0
 /// <summary>
 /// Return the current Context, ensuring that an object is the same as a Context property.
 /// </summary>
 /// <typeparam name="T">Context type</typeparam>
 /// <param name="role">Object playing a role in an extension method</param>
 /// <param name="contextRole">Context property that should be the same as the object</param>
 /// <returns>Context in initialized scope</returns>
 /// <exception cref="InvalidOperationException">If the object isn't equal to the specified Context property.</exception>
 public static T Current <T>(object role, Func <T, object> contextRole) where T : class
 {
     return(CurrentContext.Current(role, contextRole));
 }