-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExampleContext.cs
More file actions
181 lines (172 loc) · 8.71 KB
/
ExampleContext.cs
File metadata and controls
181 lines (172 loc) · 8.71 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using RapidField.SolidInstruments.Core;
using RapidField.SolidInstruments.DataAccess.EntityFramework;
using RapidField.SolidInstruments.Example.DatabaseModel.Entities;
using System;
using System.Configuration;
namespace RapidField.SolidInstruments.Example.DatabaseModel
{
/// <summary>
/// Represents a connection to a prototypical database.
/// </summary>
public class ExampleContext : ConfiguredContext
{
/// <summary>
/// Initializes a new instance of the <see cref="ExampleContext" /> class.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="applicationConfiguration" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ConfigurationErrorsException">
/// The constructor was unable to determine the appropriate connection type by evaluating the connection string.
/// </exception>
public ExampleContext(IConfiguration applicationConfiguration)
: base(applicationConfiguration)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ExampleContext" /> class.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <param name="databaseType">
/// The database type of the backing database, or <see cref="ContextDatabaseType.Unspecified" /> to determine the connection
/// type dynamically based on the format of the connection string.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="applicationConfiguration" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ConfigurationErrorsException">
/// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" /> and the constructor was
/// unable to determine the appropriate connection type by evaluating the connection string.
/// </exception>
public ExampleContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType)
: base(applicationConfiguration, databaseType)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ExampleContext" /> class.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <param name="databaseType">
/// The database type of the backing database, or <see cref="ContextDatabaseType.Unspecified" /> to determine the connection
/// type dynamically based on the format of the connection string.
/// </param>
/// <param name="databaseName">
/// The name of the backing database, which matches the associated connection string key in
/// <paramref name="applicationConfiguration" />. The default value is equal to the context's type name with "Context"
/// trimmed from the end, if found.
/// </param>
/// <exception cref="ArgumentEmptyException">
/// <paramref name="databaseName" /> is empty.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="applicationConfiguration" /> is <see langword="null" /> -or- <paramref name="databaseName" /> is
/// <see langword="null" />.
/// </exception>
/// <exception cref="ConfigurationErrorsException">
/// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" /> and the constructor was
/// unable to determine the appropriate connection type by evaluating the connection string.
/// </exception>
public ExampleContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType, String databaseName)
: base(applicationConfiguration, databaseType, databaseName)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ExampleContext" /> class.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <param name="databaseType">
/// The database type of the backing database, or <see cref="ContextDatabaseType.Unspecified" /> to determine the connection
/// type dynamically based on the format of the connection string.
/// </param>
/// <param name="trackingBehavior">
/// The query result tracking behavior for the context. The default value is <see cref="QueryTrackingBehavior.TrackAll" />.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="applicationConfiguration" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ConfigurationErrorsException">
/// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" /> and the constructor was
/// unable to determine the appropriate connection type by evaluating the connection string.
/// </exception>
public ExampleContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType, QueryTrackingBehavior trackingBehavior)
: base(applicationConfiguration, databaseType, trackingBehavior)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ExampleContext" /> class.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <param name="databaseType">
/// The database type of the backing database, or <see cref="ContextDatabaseType.Unspecified" /> to determine the connection
/// type dynamically based on the format of the connection string.
/// </param>
/// <param name="databaseName">
/// The name of the backing database, which matches the associated connection string key in
/// <paramref name="applicationConfiguration" />. The default value is equal to the context's type name with "Context"
/// trimmed from the end, if found.
/// </param>
/// <param name="trackingBehavior">
/// The query result tracking behavior for the context. The default value is <see cref="QueryTrackingBehavior.TrackAll" />.
/// </param>
/// <exception cref="ArgumentEmptyException">
/// <paramref name="databaseName" /> is empty.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="applicationConfiguration" /> is <see langword="null" /> -or- <paramref name="databaseName" /> is
/// <see langword="null" />.
/// </exception>
/// <exception cref="ConfigurationErrorsException">
/// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" /> and the constructor was
/// unable to determine the appropriate connection type by evaluating the connection string.
/// </exception>
public ExampleContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType, String databaseName, QueryTrackingBehavior trackingBehavior)
: base(applicationConfiguration, databaseType, databaseName, trackingBehavior)
{
return;
}
/// <summary>
/// Gets or sets a persistent collection of <see cref="Number" /> records.
/// </summary>
public DbSet<Number> Numbers
{
get;
set;
}
/// <summary>
/// Gets or sets a persistent collection of <see cref="NumberSeriesNumber" /> records.
/// </summary>
public DbSet<NumberSeriesNumber> NumberSeriesNumbers
{
get;
set;
}
/// <summary>
/// Gets or sets a persistent collection of <see cref="NumberSeries" /> records.
/// </summary>
public DbSet<NumberSeries> NumerSeries
{
get;
set;
}
}
}