-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDatabaseMapperExT2.cs
More file actions
21 lines (18 loc) · 1.01 KB
/
DatabaseMapperExT2.cs
File metadata and controls
21 lines (18 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/CoreEx
using System;
namespace CoreEx.Database.Mapping
{
/// <summary>
/// Provides <see cref="DatabaseMapperEx{TSource}"/> with a singleton <see cref="Default"/>.
/// </summary>
/// <typeparam name="TSource">The source <see cref="Type"/>.</typeparam>
/// <typeparam name="TMapper">The mapper <see cref="Type"/>.</typeparam>
public abstract class DatabaseMapperEx<TSource, TMapper> : DatabaseMapperEx<TSource> where TSource : class, new() where TMapper : DatabaseMapperEx<TSource, TMapper>, new()
{
private static readonly TMapper _default = new();
/// <summary>
/// Gets the current instance of the mapper.
/// </summary>
public static TMapper Default => _default ?? throw new InvalidOperationException("An instance of this Mapper cannot be referenced as it is still being constructed; beware that you may have a circular reference within the constructor.");
}
}