-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathXmlRepository.cs
More file actions
40 lines (38 loc) · 1.92 KB
/
Copy pathXmlRepository.cs
File metadata and controls
40 lines (38 loc) · 1.92 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
38
39
40
using System;
using SharpRepository.Repository;
using SharpRepository.Repository.Caching;
namespace SharpRepository.XmlRepository
{
/// <summary>
/// XML Repository layer
/// </summary>
/// <typeparam name="T">The object type that is stored as XML.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
public class XmlRepository<T, TKey> : XmlRepositoryBase<T, TKey> where T : class, new()
{
/// <summary>
/// Initializes a new instance of the <see cref="XmlRepository<T, TKey>"/> class.
/// </summary>
/// <param name="storagePath">Path to the directory where the XML files are stored. The XML filename is determined by the TypeName</param>
/// <param name="cachingStrategy">The caching strategy. Defaults to <see cref="NoCachingStrategy<T, TKey>" />.</param>
public XmlRepository(string storagePath, ICachingStrategy<T, TKey> cachingStrategy = null) : base(storagePath, cachingStrategy)
{
if (String.IsNullOrEmpty(storagePath)) throw new ArgumentNullException("storagePath");
}
}
/// <summary>
/// XML Repository layer
/// </summary>
/// <typeparam name="T">The object type that is stored as XML.</typeparam>
public class XmlRepository<T> : XmlRepositoryBase<T, int>, IRepository<T> where T : class, new()
{
/// <summary>
/// Initializes a new instance of the <see cref="XmlRepository<T>"/> class.
/// </summary>
/// <param name="storagePath">Path to the directory where the XML files are stored. The XML filename is determined by the TypeName</param>
/// <param name="cachingStrategy">The caching strategy. Defaults to <see cref="NoCachingStrategy<T>" />.</param>
public XmlRepository(string storagePath, ICachingStrategy<T, int> cachingStrategy = null) : base(storagePath, cachingStrategy)
{
}
}
}