Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TypeConverterOptionsFactory an instance variable. #318

Closed
JoshClose opened this issue Nov 22, 2014 · 4 comments
Closed

Make TypeConverterOptionsFactory an instance variable. #318

JoshClose opened this issue Nov 22, 2014 · 4 comments
Labels
Milestone

Comments

@JoshClose
Copy link
Owner

Having TypeConverterOptionsFactory be static and hold instances of types, we run into a problem in a multi-threaded environment if you want to use different cultures. #290 (comment)

Make TypeConverterOptionsFactory an instance on configuration like mentioned here. #199 (comment)

@JoshClose JoshClose added this to the 3.0 milestone Jan 28, 2015
@JoshClose JoshClose changed the title [3.0] Make TypeConverterOptionsFactory an instance variable. Make TypeConverterOptionsFactory an instance variable. Jan 28, 2015
@cleftheris
Copy link

Hi Josh I was wondering if you are planning v3 any time soon.

Regards.

@JoshClose
Copy link
Owner Author

Hopefully in the next few months. I've been sick the past 2 weeks, and just busy in general. I want to get the current items out there done too before I do 3.0.

@StefanBertels
Copy link
Contributor

Hi Josh,

this would be a great option to reduce explicit mapping, reducing coding overhead.

This would make writing anonymous types with custom datetime format a lot easier, like this one:

var element = new
                    {
                        Id = 9,
                        Text = "",
                        Timestamp = DateTime.UtcNow,
}

 using (
                            CsvWriter cw = new CsvWriter(tw,
                                new CsvConfiguration()
                                {
                                    Delimiter = ";",
                                    IsHeaderCaseSensitive = false,
                                    HasHeaderRecord = true
                                    // option missing for datetime format (typeconverter)
                                }))
                        {
                            cw.WriteRecords(new[] { element });
                        }

In the meantime I will use explicit class mapping (much more code) or use the memory inefficient and ugly way of making DateTime values string before:

TimeStamp = DateTime.UtcNow.ToString(...)

@JoshClose
Copy link
Owner Author

This is done and will be in NuGet version 3.0.0-beta6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants