by Someone1234 · 11y ago · 0 comments
We use Elmah instead of Nlog, which is also fine. Looks like NLog is a bit more flexible than Elmah is. But Elmah is KISS which is nice.
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.
Dapper distills the converting database rows to objects. It's a micro ORM, which means it doesn't try to abstract SQL like a monolithic ORM (NHibernate, EntityFramework) would do. Example:
public TagModel GetTag(long id)
{
using (var conn = m_connector.GetConnection())
{
return conn.Query<TagModel>("SELECT TOP 1 * FROM Tags WHERE Id = @Id", new { Id = id }).FirstOrDefault();
}
}It might not be really clear, sorry. Try to look on their website https://github.com/AutoMapper/AutoMapper/wiki/Getting-starte....
Automapper basically allows you to convert a DB Model to a DTO or a ViewModel.