public static T GetRequired <T>(this IAppHost appHost) { var value = appHost.GetOptional <T>(); if (object.Equals(value, default(T))) { throw new InvalidOperationException($@"Could not find the value of '{typeof(T).FullName}' type."); } return(value); }