-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExampleSqlServerContext.cs
More file actions
55 lines (51 loc) · 2.66 KB
/
ExampleSqlServerContext.cs
File metadata and controls
55 lines (51 loc) · 2.66 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
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Configuration;
using RapidField.SolidInstruments.DataAccess.EntityFramework;
using System;
namespace RapidField.SolidInstruments.Example.DatabaseModel
{
/// <summary>
/// Represents a connection to a prototypical, SQL Server database.
/// </summary>
public sealed class ExampleSqlServerContext : ExampleContext
{
/// <summary>
/// Initializes a new instance of the <see cref="ExampleSqlServerContext" /> class.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="applicationConfiguration" /> is <see langword="null" />.
/// </exception>
public ExampleSqlServerContext(IConfiguration applicationConfiguration)
: base(applicationConfiguration, ContextDatabaseType.SqlServer, QueryTrackingBehavior.TrackAll)
{
return;
}
/// <summary>
/// Configures the in-memory database to be used for this context.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <param name="optionsBuilder">
/// A builder that is used to create or modify options for this context.
/// </param>
protected sealed override void OnConfiguringInMemory(IConfiguration applicationConfiguration, InMemoryDbContextOptionsBuilder optionsBuilder) => throw new InvalidOperationException();
/// <summary>
/// Configures the SQL Server database to be used for this context.
/// </summary>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <param name="optionsBuilder">
/// A builder that is used to create or modify options for this context.
/// </param>
protected sealed override void OnConfiguringSqlServer(IConfiguration applicationConfiguration, SqlServerDbContextOptionsBuilder optionsBuilder) => base.OnConfiguringSqlServer(applicationConfiguration, optionsBuilder);
}
}