/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the value to convert into an instance of <see cref="OperationDefinitionDisplay" />.</param> /// <returns> /// an instance of <see cref="OperationDefinitionDisplay" />, or <c>null</c> if there is no suitable conversion. /// </returns> public static object ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return(null); } try { OperationDefinitionDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); } catch { // Unable to use JSON pattern } try { return(new OperationDefinitionDisplay { Description = sourceValue.Description, Operation = sourceValue.Operation, Provider = sourceValue.Provider, Resource = sourceValue.Resource, }); } catch { } return(null); }
internal OperationDefinition(string name, OperationDefinitionDisplay display) { Name = name; Display = display; }