public CsvExportProvider(ExportDataRequest exportDataRequest) { if (exportDataRequest == null) { throw new ArgumentNullException(nameof(exportDataRequest)); } Configuration = exportDataRequest.ProviderConfig as CsvProviderConfiguration ?? new CsvProviderConfiguration(); IncludedProperties = exportDataRequest.DataQuery?.IncludedProperties; }
private ExportDataRequest CreatExportDataRequest(ExportDataQuery dataQuery, IExportProviderConfiguration providerConfig = null) { var result = new ExportDataRequest() { ProviderName = nameof(CsvExportProvider), DataQuery = dataQuery, ProviderConfig = providerConfig, }; return(result); }
public JsonExportProvider(ExportDataRequest exportDataRequest) { if (exportDataRequest == null) { throw new ArgumentNullException(nameof(exportDataRequest)); } var jsonProviderConfiguration = exportDataRequest.ProviderConfig as JsonProviderConfiguration ?? new JsonProviderConfiguration(); Configuration = jsonProviderConfiguration; IncludedProperties = exportDataRequest.DataQuery?.IncludedProperties; var jsonSettings = jsonProviderConfiguration.Settings; _serializer = JsonSerializer.Create(jsonSettings); _serializer.Converters.Add(new ObjectDiscriminatorJsonConverter(jsonSettings, typeof(Entity))); }
public JsonExportProvider(ExportDataRequest exportDataRequest) { if (exportDataRequest == null) { throw new ArgumentNullException(nameof(exportDataRequest)); } var jsonProviderConfiguration = exportDataRequest.ProviderConfig as JsonProviderConfiguration ?? new JsonProviderConfiguration(); Configuration = jsonProviderConfiguration; IncludedProperties = exportDataRequest.DataQuery?.IncludedProperties; var jsonSettings = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = jsonProviderConfiguration.Indented ? Formatting.Indented : Formatting.None }; _serializer = JsonSerializer.Create(jsonSettings); _serializer.Converters.Add(new ObjectDiscriminatorJsonConverter(jsonSettings, typeof(Entity))); }