예제 #1
0
 /// <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="ClusterNetworkEntity" />.</param>
 /// <returns>
 /// an instance of <see cref="ClusterNetworkEntity" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         ClusterNetworkEntity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new ClusterNetworkEntity
         {
             Address = AddressTypeConverter.ConvertFrom(sourceValue.Address),
             Credentials = CredentialsTypeConverter.ConvertFrom(sourceValue.Credentials),
             ProxyTypeList = sourceValue.ProxyTypeList,
         });
     }
     catch
     {
     }
     return(null);
 }
예제 #2
0
 /// <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="ClusterDomainServer" />.</param>
 /// <returns>
 /// an instance of <see cref="ClusterDomainServer" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         ClusterDomainServer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new ClusterDomainServer
         {
             Name = sourceValue.Name,
             DomainCredentials = CredentialsTypeConverter.ConvertFrom(sourceValue.DomainCredentials),
             Nameserver = sourceValue.Nameserver,
         });
     }
     catch
     {
     }
     return(null);
 }
예제 #3
0
 /// <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="SspConfigInput" />.</param>
 /// <returns>
 /// an instance of <see cref="SspConfigInput" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         SspConfigInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new SspConfigInput
         {
             DirectoryServiceServiceAccount = CredentialsTypeConverter.ConvertFrom(sourceValue.DirectoryServiceServiceAccount),
             ShouldSkipMigration = sourceValue.ShouldSkipMigration,
         });
     }
     catch
     {
     }
     return(null);
 }