/// <summary> /// Gets the entity pre image as type T. /// </summary> /// <typeparam name="T">Strongly-typed Entity.</typeparam> /// <param name="context">The context.</param> /// <param name="preImageName">Name of the pre image.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"> /// context /// or /// preImageName /// </exception> public static T GetPreEntityImage <T>(this IPluginExecutionContext context, string preImageName) where T : Entity { if (context == null) { throw new ArgumentNullException("context"); } if (preImageName == null) { throw new ArgumentNullException("preImageName"); } return(context.GetPreEntityImage(preImageName).ToEntity <T>()); }