예제 #1
0
 /// <summary>
 /// Customises the given serializer settings using provider configuration.
 /// Can be used by any provider, allowing the users to use a standard set of configuration attributes.
 /// </summary>
 /// <param name="settings">The settings to update.</param>
 /// <param name="config">The provider config.</param>
 /// <returns>The updated <see cref="JsonSerializerSettings" />.</returns>
 public static JsonSerializerSettings UpdateSerializerSettings(JsonSerializerSettings settings, IProviderConfiguration config)
 {
     bool useFullAssemblyNames = config.GetBoolProperty(UseFullAssemblyNamesProperty, false);
     bool indentJson = config.GetBoolProperty(IndentJsonProperty, false);
     TypeNameHandling typeNameHandling = config.GetEnumProperty(TypeNameHandlingProperty, settings.TypeNameHandling);
     return UpdateSerializerSettings(settings, useFullAssemblyNames, indentJson, typeNameHandling);
 }
 public Task Init(string name, IProviderRuntime providerUtilitiesManager, IProviderConfiguration providerConfig)
 {
     Name = name;
     mode = providerConfig.GetEnumProperty(FailureInjectionModeString, FailureInjectionStreamProviderMode.NoFault);
     return(mode == FailureInjectionStreamProviderMode.InitializationThrowsException
         ? Task.FromException <object>(new ProviderInitializationException("Error initializing provider " + typeof(FailureInjectionStreamProvider)))
         : Task.CompletedTask);
 }