Class CsModel
Base class that all C# compiler based data models derive from.
Inheritance
Inherited Members
Namespace: CodeFactory.DotNet.CSharp
Assembly: CodeFactory.DotNet.dll
Syntax
public abstract class CsModel : ICsModel, IDotNetModel, IModelStatus
Constructors
| Improve this Doc View SourceCsModel(bool, bool, bool, SourceCodeType, CsModelType, string, ModelStore<ICsModel>, IReadOnlyList<ModelLoadException>)
Constructor for the CsModel
Declaration
protected CsModel(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, CsModelType modelType, string sourceDocument = null, ModelStore<ICsModel> modelStore = null, IReadOnlyList<ModelLoadException> modelErrors = null)
Parameters
Type | Name | Description |
---|---|---|
bool | isLoaded | Flag that determines if the model was loaded. |
bool | hasErrors | Flag that determine if errors were found creating the model. |
bool | loadedFromSource | Flag that determines if the model was loaded from source code or from an existing library. |
SourceCodeType | language | The target language the model was generated from. |
CsModelType | modelType | The type of code model created. |
string | sourceDocument | The source document that was used to build this model. This is optional parameter and can be null. |
ModelStore<ICsModel> | modelStore | Optional the lookup storage for models created during the compile or lookup of the model. |
IReadOnlyList<ModelLoadException> | modelErrors | Optional the error that occurred while creating the model. |
Fields
| Improve this Doc View SourceLocalModelErrors
Model field that stores the models load exceptions.
Declaration
protected readonly IReadOnlyList<ModelLoadException> LocalModelErrors
Field Value
Type | Description |
---|---|
IReadOnlyList<ModelLoadException> |
ModelStore
Model field used to lookup models that were created during the compile or reference lookup using the C# compiler.
Declaration
protected readonly ModelStore<ICsModel> ModelStore
Field Value
Type | Description |
---|---|
ModelStore<ICsModel> |
Properties
| Improve this Doc View SourceHasErrors
Flag that determines if this model or one of the children of this model has an error.
Declaration
public bool HasErrors { get; }
Property Value
Type | Description |
---|---|
bool |
IsLoaded
Flag that determines if this model was able to load.
Declaration
public bool IsLoaded { get; }
Property Value
Type | Description |
---|---|
bool |
Language
The target language this model was loaded from.
Declaration
public SourceCodeType Language { get; }
Property Value
Type | Description |
---|---|
SourceCodeType |
LoadedFromSource
Flag that determines if this model was loaded from source code or was loaded through reflects or symbol libraries.
Declaration
public bool LoadedFromSource { get; }
Property Value
Type | Description |
---|---|
bool |
ModelType
The type of c# model that is implemented.
Declaration
public CsModelType ModelType { get; }
Property Value
Type | Description |
---|---|
CsModelType |
SourceDocument
The fully qualified path to the document that was used to load the model from source. This will be populated if the model was loaded from source.
Declaration
public string SourceDocument { get; }
Property Value
Type | Description |
---|---|
string |
Methods
| Improve this Doc View SourceGetErrors()
Gets the ModelLoadException from the current model and all child models of this model.
Declaration
public abstract IReadOnlyList<ModelLoadException> GetErrors()
Returns
Type | Description |
---|---|
IReadOnlyList<ModelLoadException> | Returns a IReadOnlyList<T> of the ModelLoadException exceptions or an empty list if no exceptions exist. |
GetModel(string)
Declaration
public CsModel GetModel(string lookupPath)
Parameters
Type | Name | Description |
---|---|---|
string | lookupPath |
Returns
Type | Description |
---|---|
CsModel |
GetModel<T>(string)
Declaration
public T GetModel<T>(string lookupPath) where T : class, ICsModel
Parameters
Type | Name | Description |
---|---|---|
string | lookupPath |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
LookupModel(string)
Helper method that looks up a code factory model from the model store.
Declaration
[Obsolete("LookupModel is obsolete and will be removed in later versions of the framework. Use GetModel or GetModel<T>", false)]
protected CsModel LookupModel(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The fully qualified path of the model to be loaded from the model store. |
Returns
Type | Description |
---|---|
CsModel | The loaded model or null if the model could not be loaded, or found. |
Explicit Interface Implementations
| Improve this Doc View SourceIDotNetModel.ModelType
The type of dot net model that was loaded.
Declaration
DotNetModelType IDotNetModel.ModelType { get; }
Returns
Type | Description |
---|---|
DotNetModelType |