Skip to content

Instantly share code, notes, and snippets.

@carloscds
Created December 2, 2018 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carloscds/78401114238446cce2347c7a0b8da8d0 to your computer and use it in GitHub Desktop.
Save carloscds/78401114238446cce2347c7a0b8da8d0 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EFAsNoTracking
{
public class Dados
{
private Contexto _contexto;
public Dados(Contexto contexto)
{
_contexto = contexto;
}
public Categories Get(int id) => _contexto.Categories.First(c => c.CategoryID == id);
public Categories GetNoTracking(int id) => _contexto.Categories.AsNoTracking().First(c => c.CategoryID == id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment