-
Notifications
You must be signed in to change notification settings - Fork 5
/
ModelConstructionContext.cs
90 lines (80 loc) · 3.23 KB
/
ModelConstructionContext.cs
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
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ModelConstructionContext.cs" company="Kephas Software SRL">
// Copyright (c) Kephas Software SRL. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
// Implements the model construction context class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Model.Construction
{
using System;
using System.Collections.Generic;
using Kephas.Services;
using Kephas.Logging;
using Kephas.Model.Runtime.Construction;
using Kephas.Reflection;
using Kephas.Services;
/// <summary>
/// A model construction context.
/// </summary>
public class ModelConstructionContext : Context, IModelConstructionContext
{
/// <summary>
/// Initializes a new instance of the <see cref="ModelConstructionContext"/> class.
/// </summary>
/// <param name="parentContext">Context for the parent.</param>
public ModelConstructionContext(IContext parentContext)
: base(parentContext)
{
parentContext = parentContext ?? throw new ArgumentNullException(nameof(parentContext));
this.Logger = parentContext.ServiceProvider.GetLogger(this.GetType());
}
/// <summary>
/// Initializes a new instance of the <see cref="ModelConstructionContext"/> class.
/// </summary>
/// <param name="serviceProvider">The injector.</param>
public ModelConstructionContext(IServiceProvider serviceProvider)
: base(serviceProvider)
{
serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
this.Logger = serviceProvider.GetLogger(this.GetType());
}
/// <summary>
/// Gets or sets the model space.
/// </summary>
/// <value>
/// The model space.
/// </value>
public IModelSpace ModelSpace { get; set; }
/// <summary>
/// Gets or sets the model element factory.
/// </summary>
/// <value>
/// The model element factory.
/// </value>
public IRuntimeModelElementFactory RuntimeModelElementFactory { get; set; }
/// <summary>
/// Gets or sets the element infos.
/// </summary>
/// <value>
/// The element infos.
/// </value>
public IEnumerable<IElementInfo> ElementInfos { get; set; }
/// <summary>
/// Gets or sets the constructed classifiers.
/// </summary>
/// <value>
/// The constructed classifiers.
/// </value>
public IEnumerable<IClassifier> ConstructedClassifiers { get; set; }
/// <summary>
/// Gets or sets a function to try to get a model element based on a native element information.
/// </summary>
/// <value>
/// A function for getting a model element.
/// </value>
public Func<IElementInfo?, IElementInfo> TryGetModelElementInfo { get; set; }
}
}