-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIDataAccessModel.cs
More file actions
75 lines (70 loc) · 3.13 KB
/
IDataAccessModel.cs
File metadata and controls
75 lines (70 loc) · 3.13 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using RapidField.SolidInstruments.Core.Domain;
using System;
namespace RapidField.SolidInstruments.DataAccess
{
/// <summary>
/// Represents an object that models a data access entity.
/// </summary>
/// <typeparam name="TIdentifier">
/// The type of the unique primary identifier for the model.
/// </typeparam>
/// <typeparam name="TDomainModel">
/// The type of the domain model to which the data access model is mapped.
/// </typeparam>
public interface IDataAccessModel<TIdentifier, TDomainModel> : IDataAccessModel<TIdentifier>
where TIdentifier : IComparable, IComparable<TIdentifier>, IEquatable<TIdentifier>
where TDomainModel : class, IDomainModel<TIdentifier>
{
/// <summary>
/// Copies the state of the specified domain model to the current
/// <see cref="IDataAccessModel{TIdentifier, TDomainModel}" />.
/// </summary>
/// <param name="domainModel">
/// A domain model from which to hydrate the state of the data access model.
/// </param>
/// <exception cref="ArgumentException">
/// The state of <paramref name="domainModel" /> is invalid.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="domainModel" /> is <see langword="null" />.
/// </exception>
public void HydrateFromDomainModel(TDomainModel domainModel);
/// <summary>
/// Converts the current <see cref="IDataAccessModel{TIdentifier, TDomainModel}" /> to its equivalent domain model
/// representation.
/// </summary>
/// <returns>
/// An <see cref="IDomainModel{TIdentifier}" /> that is equivalent to the current data access model.
/// </returns>
/// <exception cref="TypeInitializationException">
/// An exception was raised while converting the data access model to its equivalent domain model.
/// </exception>
public TDomainModel ToDomainModel();
}
/// <summary>
/// Represents an object that models a data access entity.
/// </summary>
/// <typeparam name="TIdentifier">
/// The type of the unique primary identifier for the model.
/// </typeparam>
public interface IDataAccessModel<TIdentifier> : IDataAccessModel
where TIdentifier : IComparable, IComparable<TIdentifier>, IEquatable<TIdentifier>
{
/// <summary>
/// Gets a value that uniquely identifies the current <see cref="IDataAccessModel{TIdentifier}" />.
/// </summary>
public TIdentifier Identifier
{
get;
}
}
/// <summary>
/// Represents an object that models a data access entity.
/// </summary>
public interface IDataAccessModel
{
}
}