public static Dictionary <string, StructPropertyConverter <T> > ActivateStructPropertyConverters <T>( IConvertersCollection converters) where T : struct { var ownerType = Typeof <T> .Raw; var properties = ownerType.GetProperties(); var propertyConverters = new Dictionary <string, StructPropertyConverter <T> >( properties.Length, StringUtils.IgnoreCaseComparer); foreach (var property in properties) { if (IgnoreAttribute.IsDefined(property)) { continue; } var converter = converters.Get(property.PropertyType); var propertyConverter = new StructPropertyConverter <T>(ownerType, property, converter); propertyConverters.Add(property.Name, propertyConverter); } return(propertyConverters); }
public StructConverter(IConvertersCollection converters) : base(false) { var type = Typeof <T> .Raw; _activator = Expression.Lambda <Func <T> >(Expression.New(type)).Compile(); _properties = SerializationUtils.ActivateStructPropertyConverters <T>(converters); }
public ComponentsConverter( IConvertersCollection converters, IComponentFactory componentFactory, SourceDescriptions descriptions) { _converters = converters; _componentFactory = componentFactory; _descriptions = descriptions; }
public SettingsProvider(ISettingsSource[] sources, IConvertersCollection converters) { _configuration = new JsonObject(); _converters = converters; _sectionBuilder = BuildSection; _sources = sources; Reload(); }
public JsonFileSource(IConvertersCollection converters, SourceDescriptions descriptions, string path) : base(converters, descriptions) { if (!File.Exists(path)) { throw Error.FileNotFound(path); } _path = path; }
public Enumerator( IConvertersCollection converters, SourceDescriptions descriptions, JsonTokenizer tokenizer) { _converters = converters; _descriptions = descriptions; _tokenizer = tokenizer; Current = null !; }
protected CollectionConverter(IConvertersCollection converters) { Contract = Typeof <TCollection> .Raw; _converters = converters; _elementConverter = converters.Get <TElement>(); _elementType = Typeof <TElement> .Raw; _elementTypeNullable = _elementType.IsClass ? new Func <TElement, bool>(reference => reference == null) : notReference => false; }
public Configuration(IConvertersCollection converters = null, IConfigurationSource[] sources = null) { if (sources == null) { sources = Array.Empty <IConfigurationSource>(); } _cache = new Dictionary <string, object>(); _converters = converters ?? new ConvertersCollection(CultureInfo.InvariantCulture); _sources = sources; Reload(); }
public EntityState( IActorContext actors, IActorFactory actorFactory, IAssetContext assets, IConvertersCollection converters, SourceDescriptions descriptions) { Actors = actors; Assets = assets; _actorFactory = actorFactory; _converters = converters; _descriptions = descriptions; }
public LogProviderShould() { _logWriter = new Mock <ILogWriter>(); _logWriter .Setup(writer => writer.Write(It.IsAny <LogContext>(), It.IsAny <JsonObject>())) .Callback(_logWriteCallback); var dependencyProvider = new DependencyCollection() .AddLogs() .AddLogWriter(_logWriter.Object) .BuildProvider(); _converters = dependencyProvider.GetRequired <IConvertersCollection>(); _logger = dependencyProvider.GetRequired <ILogger <LogProviderShould> >(); _sender = typeof(LogProviderShould); }
public LoggerShould(ITestOutputHelper output) : base(output) { _logEnricher = new Mock <ILogEnricher>(); _logWriter = new Mock <ILogWriter>(); _testLogWriter = new TestLogWriter(); var provider = new DependencyCollection() .AddLogging() .AddJsonConverter() // for register IConvertersCollection .AddDefaultLogEnrichers() .AddLogWriter(_testLogWriter) .AddLogWriter(_logWriter.Object) .AddLogWriter <ConsoleLogWriter>() .AddLogEnricher(_logEnricher.Object) .AddLogEnricher <TestLogEnricher>() .BuildProvider(); _convertersCollection = provider.GetRequiredService <IConvertersCollection>(); _logger = provider.GetRequiredService <ILogger <LoggerShould> >(); }
public RenderersCollection(IConvertersCollection converters) { _arrayRendererBuilder = BuildArrayRenderer; _converters = converters; _rendererBuilder = BuildRenderer; }
public JsonObjectShould() { _converters = BuildConvertersCollection(); }
public ListConverter(IConvertersCollection converters) : base(converters) { }
protected JsonSource(IConvertersCollection converters, SourceDescriptions descriptions) { _converters = converters; _descriptions = descriptions; }
internal JConverter(IConvertersCollection converters) { Converters = converters; }
public ObjectConverterShould() { _converters = BuildConvertersCollection(); _converter = _converters.Get <Boo>(); }
public JsonStreamSource(IConvertersCollection converters, SourceDescriptions descriptions, Stream stream) : base(converters, descriptions) { _stream = stream; }
public JConverter(CultureInfo culture = null) { _converters = new ConvertersCollection(culture ?? CultureInfo.InvariantCulture); }
public static T Read <T>(this IConvertersCollection converters, JsonData json) { return(converters.Get <T>().Read(json)); }
public static JsonData Write <T>(this IConvertersCollection converters, T data) { return(converters.Get <T>().Write(data)); }
public JsonDataShould() { _converters = BuildConvertersCollection(); }
public ArrayConverter(IConvertersCollection converters) : base(converters) { }
public IdConverter(IConvertersCollection converters, SourceDescriptions descriptions) { _descriptions = descriptions; _intConverter = converters.Get <int>(); _stringConverter = converters.Get <string>(); }
public RendererCollection(IConvertersCollection converters = null) { _converters = converters ?? new ConvertersCollection(CultureInfo.InvariantCulture); _renderers = new Dictionary <string, Renderer>(); _lock = new object(); }
public ConvertersCollectionShould() { _converters = BuildConvertersCollection(); }
public JsonFileStore(IConvertersCollection converters, string path) { _converters = converters; _path = path; }
internal JConverter(IConvertersCollection convertersCollection) { _converters = convertersCollection; }
public JsonObjectShould(ITestOutputHelper output) : base(output) { _converters = new ConvertersCollection(CultureInfo.InvariantCulture); }
public ArrayRenderer(string[] arguments, IFormatter formatter, LocalList <Type> argumentTypes, IConvertersCollection converters) : base(formatter) { var argumentConverters = new IJsonConverter[argumentTypes.Length]; for (var i = 0; i < argumentTypes.Length; i++) { argumentConverters[i] = converters.Get(argumentTypes[i]); } _arguments = arguments; _converters = argumentConverters; }