Live data from Hacker News

Open Source .NET libraries that make your life easier

thomasvm.github.io

31–40 of 116 posts

Re: Open Source .NET libraries that make your life easier

#32
post #26

As an alternative to CsvHelper I can recommend FileHelpers by Marcos Meli: http://filehelpers.sourceforge.net/ Don't be put off by the dated SourceForge location. It is pure awesome for getting data in and out of CSV format.

How well does it handle the oddball cases? Not that you could call CSV a rigorously-defined spec, but we have a vendor that sends us a file where they sometimes don't escape double-quotes correctly.

Re: Open Source .NET libraries that make your life easier

#33
post #26

As an alternative to CsvHelper I can recommend FileHelpers by Marcos Meli: http://filehelpers.sourceforge.net/ Don't be put off by the dated SourceForge location. It is pure awesome for getting data in and out of CSV format.

As someone who spends a lot of time on file processing I appreciate the link. Althought I have to selfishly admit that had I stumbled on to this myself I would have avoided it just because of SourceForge.

Re: Open Source .NET libraries that make your life easier

#34
post #32
post #26

As an alternative to CsvHelper I can recommend FileHelpers by Marcos Meli: http://filehelpers.sourceforge.net/ Don't be put off by the dated SourceForge location. It is pure awesome for getting data in and out of CSV format.

How well does it handle the oddball cases? Not that you could call CSV a rigorously-defined spec, but we have a vendor that sends us a file where they sometimes don't escape double-quotes correctly.

That is where I've found it's strengths to be. I've used it to process affiliate feed data. The quality is pretty poor and it has been pretty robust.

Re: Open Source .NET libraries that make your life easier

#35
post #30
post #4

To add to the author's list: * I seem to install Json.net in every .NET project I create (json serializer - thanks James Newton-King!) * NLog for logging. It's fantastic. * Dapper is also excellent (Micro ORM) (and anything written by Marc Gravell is generally top-notch - see protobuf-net, miniprofiler, StackExchange.Redis) * Automapper, to avoid writing boilerplate code to convert between similarly shaped types (E.G…

Was going to post Dapper, Automapper and RestSharp myself. I use ELMAH for logging but I'll give NLog a look!

I also can recommend StackExchange Exceptional and Opserver from the StackExchange crew for logging: https://github.com/opserver/Opserver

Re: Open Source .NET libraries that make your life easier

#36
post #22

TopShelf looks interesting, I have written quite a few Windows services over the years and there have always been lots of gaps in the MS offering.

I've just rolled out a service using TopShelf having not used it previously. It really does simplify things. The best bit for me is being able to just hit F5 and having the thing run as a console application. No need to manually attach to processes for debugging.

This technique lets you debug your service as if it were a console app - just pass in -a on the command line.

In your Main method:

            if (args.Length > 0 && args[0] == "-a")
            {
                // Running as an application
                MyService ms = new MyService();
                ms.DoStart();
                Console.WriteLine("Press Enter to Stop");
                Console.ReadLine();
                ms.DoStop();
            } else {
                // Running as a service
                ServiceBase[] servicesToRun = { new MyService() };
                ServiceBase.Run(servicesToRun);
            }
And in the MyService class that derives from ServiceBase:

        protected override void OnStart(string[] args)
        {
            DoStart();
        }

        protected override void OnStop()
        {
            DoStop();
        }

        internal void DoStart()
        {
            // Start your service thread here
        }

        internal void DoStop()
        {
            // Tell your service thread to stop here
        }

Re: Open Source .NET libraries that make your life easier

#37
post #17

Earlier quoted context omitted.

I think you're asking about Dapper (ORM) which could be compared to Entity Framework. The two major things to think about if comparing would be simplicity and speed. Dapper is simple to setup and use. It uses standard SQL and it's very fast. On the other hand, this is not a fair comparison. EF is has many more features and options. Use the right tool for the right job depending on requirements. Elmah and NLog are not…

In fact it is not uncommon for me to use both Dapper and EF on the same project. Usually I'll use Dapper for the query/reporting side and EF for the domain model/update side. (Used to use nHibernate, but it seems to have really stagnated unfortunately)

Even then, for query building I found EF (or any LINQ provider for SQL) to be easier solution than string concatenation. Well, at least for relatively simple queries with pagination and stuff. For filters, Dynamic.Linq would be helpful here.

On the other side, if you need to work extensively with stored procedures or you have complicated or custom SQL to run, Dapper (or Insight.Database - https://github.com/jonwagner/Insight.Database, a library which I found really nice to use) will be your best friend.

Re: Open Source .NET libraries that make your life easier

#38
post #31

I used to use NLog for logging until I've discovered Serilog ( http://serilog.net/ ) - simple .NET logging with fully-structured events.

Serilog is awesome. Log context is awesome.

I'm a bit torn because ETW is prob the way forward for us but it doesn't have a good ecosystem currently and offers nothing like log context... Though some higher order function magics might help.

Re: Open Source .NET libraries that make your life easier

#39
post #16

Surprised no one has mentioned Nancy: https://github.com/NancyFx/Nancy I can't imagine building APIs without it now.

I find NancyFX really interesting, but I can't really see a reason to stray away from Web API2 besides Mono support. Any specific reasons you prefer Nancy?

I agree with you, but maybe because it's lightweight? It's pretty damn simple.

Re: Open Source .NET libraries that make your life easier

#40
post #4

To add to the author's list: * I seem to install Json.net in every .NET project I create (json serializer - thanks James Newton-King!) * NLog for logging. It's fantastic. * Dapper is also excellent (Micro ORM) (and anything written by Marc Gravell is generally top-notch - see protobuf-net, miniprofiler, StackExchange.Redis) * Automapper, to avoid writing boilerplate code to convert between similarly shaped types (E.G…

> * Microsoft's Unity is a great IOC framework, although most people seem to use NInject

Autofac is my favorite. Once built, containers are immutable, there is deterministic disposal of components in 'lifetime scopes', and delegate factories make it much easier to instantiate classes with a mixture of services and data.

Post reply on HN