Live data from Hacker News

Open Source .NET libraries that make your life easier

thomasvm.github.io

41–50 of 116 posts

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

#41
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've been wondering this, too. I've been using MVC since version 2 and am very comfortable with it and Web API, but a startup I've been doing side-work for is using Nancy. Nancy does seem lighter weight, and includes TinyIoC for dependency injection out-of-the-box, but I too don't see a real killer use case for Nancy.

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

#42
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…

Dapper is a really awesome library when you want to write complex queries (full of table hints, output clauses, merges and other advanced stuff), but don't want to write enormous amount of code for adding parameters and reading result sets.

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

#43
post #36
post #22

Earlier quoted context omitted.

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.R…

I use something similar to debug a WCF project:

  private static void Main()
  {
    var serviceHandler = new ServiceHandler();

    if (Environment.UserInteractive)
    {
      serviceHandler.OnStart(null);
      Console.WriteLine("Service started! Press  to terminate service.");
      Console.ReadLine();
      serviceHandler.OnStop();
      Console.WriteLine("Service stopped!");
      return;
    }
    
    Run(serviceHandler);
  }

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

#47

Earlier quoted context omitted.

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…

It's true. What I really would like is a micro-orm like Dapper with support for using LINQ to dynamically build queries. But I suppose this is essentially EF with AsNoTracking, which I have yet to play around with and test performance wise.

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

#49
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…

> RestSharp makes talking to RESTful apis easier.

Another interesting library for doing REST APIs is Refit: https://github.com/paulcbetts/refit

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

#50
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 to me is a much more modern logging solution. Allows us to pipe logs to table storage/sqlserver/loggly/logentries/docdb/azure event hub ... its the backbone of our app - really just awesome
Post reply on HN