-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathRepositoryBase.cs
More file actions
27 lines (23 loc) · 1.06 KB
/
RepositoryBase.cs
File metadata and controls
27 lines (23 loc) · 1.06 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
// Copyright © 2017 Dmitry Sikorsky. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using ExtCore.Data.Abstractions;
using ExtCore.Data.Entities.Abstractions;
namespace ExtCore.Data.Dapper;
/// <summary>
/// Implements the <see cref="IRepository">IRepository</see> interface and represents default repository behavior.
/// </summary>
/// <typeparam name="TEntity">The entity type this repository operates.</typeparam>
public abstract class RepositoryBase<TEntity> : IRepository where TEntity : class, IEntity
{
protected IStorageContext storageContext;
protected string connectionString;
/// <summary>
/// Sets the Dapper storage context that represents the physical storage to work with.
/// </summary>
/// <param name="storageContext">The Dapper storage context to set.</param>
public void SetStorageContext(IStorageContext storageContext)
{
this.storageContext = storageContext;
this.connectionString = (storageContext as StorageContextBase).ConnectionString;
}
}