Skip to content

Instantly share code, notes, and snippets.

@aidanmorgan
Created June 16, 2011 14:58
Show Gist options
  • Save aidanmorgan/1029410 to your computer and use it in GitHub Desktop.
Save aidanmorgan/1029410 to your computer and use it in GitHub Desktop.
namespace WhiskeyRecommender.Persistence
{
/// <summary>
/// A <see cref="IUnitOfWork"/> wraps a database transaction and provides access to the objects via a repository pattern.
///
/// This class implements <see cref="IDisposable"/> to allow use inside <c>using</c> blocks, and should automatically
/// close the database transaction (without saving) when disposed.
/// </summary>
public interface IUnitOfWork : IDisposable
{
/// <summary>
/// The name of this <see cref="IUnitOfWork"/>.
/// </summary>
string Name { get; set; }
/// <summary>
/// An implementation of the <see cref="IWhiskeyRepository"/> interface, bound to this <see cref="IUnitOfWork"/>.
/// </summary>
IWhiskeyRepository WhiskeyRepository { get; }
/// <summary>
/// An implementation of the <see cref="IUserRepository"/> interface, bound to this <see cref="IUnitOfWork"/>.
/// </summary>
IUserRepository UserRepository { get; }
/// <summary>
/// An implementation of the <see cref="IRegionRepository"/> interface, bound to this <see cref="IUnitOfWork"/>.
/// </summary>
IRegionRepository RegionRepository { get; }
/// <summary>
/// An implementation of the <see cref="IDistilleryRepository"/> interface, bound to this <see cref="IUnitOfWork"/>.
/// </summary>
IDistilleryRepository DistilleryRepository { get; }
/// <summary>
/// An implementation of the <see cref="IRatingRepository"/> interface, bound to this <see cref="IUnitOfWork"/>.
/// </summary>
IRatingRepository RatingRepository { get; }
/// <summary>
/// An implementation of the <see cref="IWhiskeyTypeRepository"/> interface, bound to this <see cref="IUnitOfWork"/>.
/// </summary>
IWhiskeyTypeRepository WhiskeyTypeRepository { get; }
/// <summary>
/// An implementation of the <see cref="IAchievementRepository"/> interface, bound to this <see cref="IUnitOfWork"/>.
/// </summary>
IAchievementRepository AchievementRepository { get; }
/// <summary>
/// Saves any pending changes to the database.
/// </summary>
void Save();
/// <summary>
/// Closes the <see cref="IUnitOfWork"/>, releasing any database resources.
/// </summary>
void Close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment