Skip to content

Instantly share code, notes, and snippets.

@jpolvora
Created November 8, 2011 21:05
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 jpolvora/1349224 to your computer and use it in GitHub Desktop.
Save jpolvora/1349224 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
namespace Metavision.Infra.Data
{
public interface IUnitOfWork : IDisposable
{
T Find<T>(params object[] keyValues) where T : class , new();
/// <summary>
/// Deve adicionar um registro ao repositório
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="entity"></param>
void Add<T>(T entity) where T : class;
/// <summary>
/// Deve remover um registro do repositório
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="entity"></param>
void Remove<T>(T entity) where T : class;
/// <summary>
/// Deve retornar um objeto IQueryable do repositório
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
IQueryable<T> Get<T>() where T : class;
/// <summary>
/// Deve retornar a quantidade de repositórios que estão anexados ao UnitOfWork atual
/// </summary>
int AttachedRepositories { get; }
/// <summary>
/// Persiste os dados de todos os repositórios anexados ao UnitOfWork atual
/// </summary>
/// <returns></returns>
int Commit();
/// <summary>
/// Deve cancelar todas as operações pendentes
/// </summary>
void RollBack();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment