question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fluent configuration support for CsvOutputFormatter

See original GitHub issue

Hello community,

I would very much like to add ‘fluent’ configuration support for CsvOutputFormatter. It would work similarly to FluentValidation or EF, and would look like:

Startup.cs

services
	.AddMvc()
	.AddCsvSerializerFormatters(options =>
		options.RegisterConfigsFromAssemblyContaining<BusinessProfile>();
	);

InvoiceFormatterConfig.cs - a config

	public class InvoiceFormatterConfig : CsvFormattingConfiguration<InvoiceModel>
	{
		public void Configure(CsvFormattingBuilder<InvoiceModel> builder)
		{
			builder
				.UseHeaders()
				.ForHeader("Name")
				.UseProperty(i => i.Name)
				.ForHeader("GrandTotal")
				.UseProperty(i => i.InvoiceDetails.GrandTotal);
		}
	}

CsvOutputFormatter would use this configuration and would be able to generate CSV based on it. Please let mne know what do you think. I am doing it anyway for my project, I just think it’s something that would be far better than creating separate model type with primitive properties and using automapper to map entity type to our new model––which would exist only for the purpose of formatters. What do you think? Are you interested in my contribution?

ps: this could be also implemented for other formatter types.

Best Regards Piotr Kolodziej

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
filipwcommented, May 18, 2018

Yes just push your changes to a new branch in your fork. You will then be able to open a PR from your fork into WebAPIContrib.Core master.

As soon as you push a branch with changes to your fork, and navigate to the root of WebApiContrib.Core repo, GH will automatically detect that you have some changes and offer a new button to open a PR.

Alternatively you can always trigger a PR from a fork branch using the following link: https://github.com/WebApiContrib/WebAPIContrib.Core/compare/master...piotrkolodziej:NAME_OF_YOUR_BRANCH

1reaction
piotrkolodziejcommented, May 17, 2018

@damienbod Let me work on a prototype for few days and reply to your question when I have more details.

Read more comments on GitHub >

github_iconTop Results From Across the Web

csv
formatter plugin output an event as CSV. · Specifies the output fields. It is a required parameter. · Delimiter for values. · to...
Read more >
Support of CSV format for websocket output plugin #5828
out_websocket : Currently only FILE output plugin writes the logs/messages in CSV format. And websocket output plugin supports only Json, Json- ...
Read more >
File - Fluent Bit: Official Manual
Output the records as csv. Csv supports an additional configuration parameter.
Read more >
File - Calyptia for Fluent Bit
Format ; csv format. Output the records as csv. Csv supports an additional configuration parameter. · Delimiter ; ltsv format. Output the records...
Read more >
fluent-plugin-s3 csv format
I am looking to write logs using a fixed format similar to Tomcat / IIS logs and store ... https://github.com/fluent/fluent-plugin-s3#output-configuration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found