-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVsModel.cs
More file actions
66 lines (58 loc) · 2.53 KB
/
VsModel.cs
File metadata and controls
66 lines (58 loc) · 2.53 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
//*****************************************************************************
//* Code Factory SDK
//* Copyright (c) 2020 CodeFactory, LLC
//*****************************************************************************
using System.Collections.Generic;
using System.Collections.Immutable;
namespace CodeFactory.VisualStudio
{
/// <summary>
/// Base class used by all visual studio models.
/// </summary>
public abstract class VsModel:IVsModel
{
#region Property backing fields
private readonly bool _isLoaded;
private readonly bool _hasErrors;
private readonly IReadOnlyList<ModelException<VisualStudioModelType>> _modelErrors;
private readonly VisualStudioModelType _modelType;
private readonly string _name;
#endregion
/// <summary>
/// Constructor for the base class <see cref="VsModel"/>
/// </summary>
/// <param name="isLoaded">Flag that determines if the model is loaded.</param>
/// <param name="hasErrors">Flag that determines if errors occurred while loading the model.</param>
/// <param name="modelErrors">The list of errors that occurred if any.</param>
/// <param name="modelType">The type of visual studio model that is loaded.</param>
/// <param name="name">The name of the model.</param>
protected VsModel(bool isLoaded, bool hasErrors, IReadOnlyList<ModelException<VisualStudioModelType>> modelErrors, VisualStudioModelType modelType, string name)
{
_isLoaded = isLoaded;
_hasErrors = hasErrors;
_modelErrors = modelErrors ?? ImmutableList<ModelException<VisualStudioModelType>>.Empty;
_modelType = modelType;
_name = name;
}
/// <summary>
/// Flag that determines if this model was able to load.
/// </summary>
public bool IsLoaded => _isLoaded;
/// <summary>
/// Flag that determines if this model has errors.
/// </summary>
public bool HasErrors => _hasErrors;
/// <summary>
/// List of all errors that occurred in this model.
/// </summary>
public IReadOnlyList<ModelException<VisualStudioModelType>> ModelErrors => _modelErrors;
/// <summary>
/// Determines the type of model that has been loaded.
/// </summary>
public VisualStudioModelType ModelType => _modelType;
/// <summary>
/// The name of the visual studio model.
/// </summary>
public string Name => _name;
}
}