Class CsAttribute
Data model that represents an attribute.
Implements
Inherited Members
Namespace: CodeFactory.DotNet.CSharp
Assembly: CodeFactory.DotNet.dll
Syntax
public abstract class CsAttribute : CsModel, ICsAttribute, ICsModel, IDotNetAttribute, IDotNetModel, IModelStatus, ISourceFiles, IParent, IParent
Constructors
| Improve this Doc View SourceCsAttribute(bool, bool, bool, SourceCodeType, string, IReadOnlyList<string>, bool, string, IReadOnlyList<CsAttributeParameter>, CsType, string, ModelStore<ICsModel>, IReadOnlyList<ModelLoadException>)
Constructor for the CsAttribute
Declaration
protected CsAttribute(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, string modelSourceFile, IReadOnlyList<string> sourceFiles, bool hasParameters, string parentPath, IReadOnlyList<CsAttributeParameter> parameters, CsType type, 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. |
string | modelSourceFile | The soure code file for the model. |
IReadOnlyList<string> | sourceFiles | The list of source files the attribute is defined in. |
bool | hasParameters | Flag that determines if the attribute has parameters. |
string | parentPath | The fully qualified lookup path to the parent model for this attribute. |
IReadOnlyList<CsAttributeParameter> | parameters | The list of parameters assigned to the attribute. |
CsType | type | The target type of the attribute. |
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. |
Properties
| Improve this Doc View SourceHasParameters
Flag that determines if the attribute has parameters
Declaration
public bool HasParameters { get; }
Property Value
Type | Description |
---|---|
bool |
ModelSourceFile
Declaration
public string ModelSourceFile { get; }
Property Value
Type | Description |
---|---|
string |
Parameters
Enumeration of the parameters that are assigned to the attribute. This will be an empty list if HasParameters is false.
Declaration
public IReadOnlyList<CsAttributeParameter> Parameters { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsAttributeParameter> |
Parent
The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
Declaration
public CsModel Parent { get; }
Property Value
Type | Description |
---|---|
CsModel |
SourceFiles
The source file or files in which the model was loaded from. This will be an empty enumeration if the source models were loaded from metadata only.
Declaration
public IReadOnlyList<string> SourceFiles { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Type
The type information for the attribute itself.
Declaration
public CsType Type { get; }
Property Value
Type | Description |
---|---|
CsType |
Methods
| Improve this Doc View SourceAddAfterAsync(string, string)
Adds the source code directly after the definition of the CsAttributein the target document.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> AddAfterAsync(string sourceDocument, string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceDocument | The fully qualified path to the source code document to be updated. |
string | sourceCode | The source code that is to be added to the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the CsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
AddAfterAsync(string)
Adds the source code directly after the definition of the CsAttributein the target document.
Declaration
public abstract Task<CsSource> AddAfterAsync(string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceCode | The source code that is to be added to the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the CsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
AddBeforeAsync(string, string)
Adds the source code directly before the definition of the ICsAttributein the target document.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> AddBeforeAsync(string sourceDocument, string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceDocument | The fully qualified path to the source code document to be updated. |
string | sourceCode | The source code that is to be added to the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
AddBeforeAsync(string)
Adds the source code directly before the definition of the ICsAttributein the target document.
Declaration
public abstract Task<CsSource> AddBeforeAsync(string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceCode | The source code that is to be added to the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
DeleteAsync()
Deletes the definition of the attribute from the source document.
Declaration
public abstract Task<CsSource> DeleteAsync()
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the CsSource model after the attribute has been removed from the document. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
DeleteAsync(string)
Deletes the definition of the attribute from the source document.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> DeleteAsync(string sourceDocument)
Parameters
Type | Name | Description |
---|---|---|
string | sourceDocument | The source document that the attribute is to be removed from. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the CsSource model after the attribute has been removed from the document. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
GetSourceLocationAsync()
Gets the starting and ending locations within the document where the attribute is located.
Declaration
public abstract Task<ISourceLocation> GetSourceLocationAsync()
Returns
Type | Description |
---|---|
Task<ISourceLocation> | The source location for the attribute. |
Exceptions
Type | Condition |
---|---|
DocumentException | Raised when an error occurs getting the location from the document. |
GetSourceLocationAsync(string)
Gets the starting and ending locations within the document where the attribute is located.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<ISourceLocation> GetSourceLocationAsync(string sourceDocument)
Parameters
Type | Name | Description |
---|---|---|
string | sourceDocument | The fully qualified path to the document that has the attribute defined in. |
Returns
Type | Description |
---|---|
Task<ISourceLocation> | The source location for the attribute. |
Exceptions
Type | Condition |
---|---|
DocumentException | Raised when an error occurs getting the location from the document. |
ReplaceAsync(string, string)
Replaces the current attribute with the provided source code.
Declaration
[Obsolete("No longer support will be removed in later edition, you no longer need to pass the source document.", false)]
public abstract Task<CsSource> ReplaceAsync(string sourceDocument, string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceDocument | The fully qualified path to the source code document to be updated. |
string | sourceCode | The source code that is to be used to replace the original definition in the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the CsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
ReplaceAsync(string)
Replaces the current attribute with the provided source code.
Declaration
public abstract Task<CsSource> ReplaceAsync(string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceCode | The source code that is to be used to replace the original definition in the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the CsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
Explicit Interface Implementations
| Improve this Doc View SourceIDotNetAttribute.Parameters
Enumeration of the parameters that are assigned to the attribute. This will be an empty list if HasParameters is false.
Declaration
IReadOnlyList<IDotNetAttributeParameter> IDotNetAttribute.Parameters { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetAttributeParameter> |
IDotNetAttribute.Type
The type information for the attribute itself.
Declaration
IDotNetType IDotNetAttribute.Type { get; }
Returns
Type | Description |
---|---|
IDotNetType |
IParent.Parent
The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
Declaration
IDotNetModel IParent.Parent { get; }
Returns
Type | Description |
---|---|
IDotNetModel |