forked from ExtCore/ExtCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIStorage.cs
More file actions
37 lines (32 loc) · 1.17 KB
/
IStorage.cs
File metadata and controls
37 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright © 2015 Dmitry Sikorsky. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
namespace ExtCore.Data.Abstractions
{
/// <summary>
/// Describes a storage that is implementation of the Unit of Work design pattern with the mechanism
/// of getting the repositories to work with the underlying storage context and committing the changes
/// made by all the repositories.
/// </summary>
public interface IStorage
{
/// <summary>
/// Gets the underlying storage context used by this storage.
/// </summary>
IStorageContext StorageContext { get; }
/// <summary>
/// Gets a repository of the given type.
/// </summary>
/// <typeparam name="T">The type parameter to find implementation of.</typeparam>
/// <returns></returns>
T GetRepository<T>() where T: IRepository;
/// <summary>
/// Commits the changes made by all the repositories.
/// </summary>
void Save();
/// <summary>
/// Asynchronously commits the changes made by all the repositories.
/// </summary>
Task SaveAsync();
}
}