-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExampleRepositoryFactory.cs
More file actions
67 lines (63 loc) · 3.08 KB
/
ExampleRepositoryFactory.cs
File metadata and controls
67 lines (63 loc) · 3.08 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
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using Microsoft.Extensions.Configuration;
using RapidField.SolidInstruments.DataAccess;
using RapidField.SolidInstruments.DataAccess.EntityFramework;
using RapidField.SolidInstruments.Example.DatabaseModel.Repositories;
using RapidField.SolidInstruments.ObjectComposition;
using System;
namespace RapidField.SolidInstruments.Example.DatabaseModel
{
/// <summary>
/// Encapsulates creation of new <see cref="IDataAccessRepository" /> that map to Example database entities.
/// </summary>
public sealed class ExampleRepositoryFactory : EntityFrameworkRepositoryFactory<ExampleContext>
{
/// <summary>
/// Initializes a new instance of the <see cref="ExampleRepositoryFactory" /> class.
/// </summary>
/// <param name="context">
/// The database session that is used by the produced repositories.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="context" /> is <see langword="null" />.
/// </exception>
public ExampleRepositoryFactory(ExampleContext context)
: base(context)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ExampleRepositoryFactory" /> class.
/// </summary>
/// <param name="context">
/// The database session that is used by the produced repositories.
/// </param>
/// <param name="applicationConfiguration">
/// Configuration information for the application.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="context" /> is <see langword="null" /> -or- <paramref name="applicationConfiguration" /> is
/// <see langword="null" />.
/// </exception>
public ExampleRepositoryFactory(ExampleContext context, IConfiguration applicationConfiguration)
: base(context, applicationConfiguration)
{
return;
}
/// <summary>
/// Configures the current <see cref="ExampleRepositoryFactory" />.
/// </summary>
/// <param name="configuration">
/// Configuration information for the current <see cref="ExampleRepositoryFactory" />.
/// </param>
/// <param name="context">
/// The database session that is used by the produced repositories.
/// </param>
protected override void Configure(ObjectFactoryConfiguration<IDataAccessRepository> configuration, ExampleContext context) => configuration.ProductionFunctions
.Add(() => new NumberRepository(context))
.Add(() => new NumberSeriesNumberRepository(context))
.Add(() => new NumberSeriesRepository(context));
}
}