public List <Contact> Find(ISpecification <Contact> specification)
 {
     using (var unitOfWork = new UnitOfWorkScope <ContactDBContext>(UnitOfWorkScopePurpose.Reading))
     {
         return(unitOfWork.DbContext.Contacts.Where(specification.SearchFunction).ToList());;
     }
 }
 public void Delete(Guid entityId)
 {
     using (var unitOfWork = new UnitOfWorkScope <ContactDBContext>(UnitOfWorkScopePurpose.Reading))
     {
         unitOfWork.DbContext.Contacts.Remove(GetById(entityId));
     }
 }
 public List <Contact> GetAll()
 {
     using (var unitOfWork = new UnitOfWorkScope <ContactDBContext>(UnitOfWorkScopePurpose.Reading))
     {
         return(unitOfWork.DbContext.Contacts.ToList());
     }
 }
 public Guid Add(Contact entity)
 {
     using (var unitOfWork = new UnitOfWorkScope <ContactDBContext>(UnitOfWorkScopePurpose.Writing))
     {
         unitOfWork.DbContext.Contacts.Add(entity);
         unitOfWork.SaveChanges();
         return(entity.Id);
     }
 }