Class CsManualUsingStatement
Manual data model class that captures a target namespace and potential alias. Will throw exceptions if any of the methods are called.
Implements
Inherited Members
Namespace: CodeFactory.Formatting.CSharp
Assembly: CodeFactory.Formatting.CSharp.dll
Syntax
public class CsManualUsingStatement : ICsUsingStatement, IDotNetNamespaceReference, ILookup, ICsModel, IDotNetModel, IModelStatus, IParent, IParent
Constructors
| Improve this Doc View SourceCsManualUsingStatement(string, string)
Creates a instance of CsManualUsingStatement
Declaration
public CsManualUsingStatement(string nameSpace, string alais = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | nameSpace | Target namespace that is called in the using statement. |
| string | alais | Optional the alais assigned to the referenced namespace. |
Properties
| Improve this Doc View SourceAlias
The alias assigned to the namespace being imported. This will be null if the HasAlias is false.
Declaration
public string Alias { get; }
Property Value
| Type | Description |
|---|---|
| string |
HasAlias
Flag that determines if the namespace reference has an alias.
Declaration
public bool HasAlias { get; }
Property Value
| Type | Description |
|---|---|
| bool |
HasErrors
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
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. This will always be false since its a manual model.
Declaration
public bool LoadedFromSource { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LookupPath
The fully qualified path for this model that can be used when searching the source for the model. This will not be populated on the manual model.
Declaration
public string LookupPath { get; }
Property Value
| Type | Description |
|---|---|
| string |
ModelType
Declaration
public CsModelType ModelType { get; }
Property Value
| Type | Description |
|---|---|
| CsModelType |
Parent
The parent to the current model. This will return null since it is a manual model.
Declaration
public CsModel Parent { get; }
Property Value
| Type | Description |
|---|---|
| CsModel |
ReferenceNamespace
The target namespace that is being imported into the sources scope.
Declaration
public string ReferenceNamespace { get; }
Property Value
| Type | Description |
|---|---|
| string |
SourceDocument
The fully qualified path to the document that was used to load the model from source. This will not be populated on the manual model.
Declaration
public string SourceDocument { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Improve this Doc View SourceAddAfterAsync(string, string)
Adds the source code directly after the definition of the ICsUsingStatement in the target document.
Declaration
public 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 ICsSource model after the changes have been applied. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
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 ICsUsingStatement in the target document.
Declaration
public 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 ICsSource model after the changes have been applied. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
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 ICsUsingStatement in the target document.
Declaration
public 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. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
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 ICsUsingStatement in the target document.
Declaration
public 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. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
DeleteAsync()
Deletes the definition of the using statement from the source document.
Declaration
public Task<CsSource> DeleteAsync()
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the using statement has been removed from the document. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
DeleteAsync(string)
Deletes the definition of the using statement from the source document.
Declaration
public Task<CsSource> DeleteAsync(string sourceDocument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The source document that the using statement is to be removed from. |
Returns
| Type | Description |
|---|---|
| Task<CsSource> | A newly loaded copy of the ICsSource model after the using statement has been removed from the document. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
GetErrors()
Gets the ModelLoadException from the current model and all child models of this model.
Declaration
public IReadOnlyList<ModelLoadException> GetErrors()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ModelLoadException> | Returns a IReadOnlyList<T> of the ModelLoadException exceptions or an empty list if no exceptions exist. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
GetModel(string)
Searchs for an existing C# model that has been loaded with the load of the source code.
Declaration
public CsModel GetModel(string lookupPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lookupPath | The lookup path that is assigned to a loaded model. |
Returns
| Type | Description |
|---|---|
| CsModel | Returns the model as the base CsModel type. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
GetSourceLocationAsync()
Gets the starting and ending locations within the document where the using statement is located.
Declaration
public Task<ISourceLocation> GetSourceLocationAsync()
Returns
| Type | Description |
|---|---|
| Task<ISourceLocation> | The source location for the using statement. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
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 using statement is located.
Declaration
public Task<ISourceLocation> GetSourceLocationAsync(string sourceDocument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceDocument | The fully qualified path to the document that has the using statement defined in. |
Returns
| Type | Description |
|---|---|
| Task<ISourceLocation> | The source location for the using statement. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Raised when an error occurs getting the location from the document. |
ReplaceAsync(string, string)
Replaces the current using statement with the provided source code.
Declaration
public 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 ICsSource model after the changes have been applied. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
ReplaceAsync(string)
Replaces the current using statement with the provided source code.
Declaration
public 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 ICsSource model after the changes have been applied. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
Exceptions
| Type | Condition |
|---|---|
| DocumentException | Error is raised when errors occur updating the source document. |
Explicit Interface Implementations
| Improve this Doc View SourceICsModel.GetModel<T>(string)
Searchs for an existing C# model that has been loaded with the load of the source code.
Declaration
T ICsModel.GetModel<T>(string lookupPath) where T : class, ICsModel
Parameters
| Type | Name | Description |
|---|---|---|
| string | lookupPath | The lookup path that is assigned to a loaded model. |
Returns
| Type | Description |
|---|---|
| T | Returns the model as the identified type it will either return the instance or null if it is not found or not the correct type. |
Type Parameters
| Name | Description |
|---|---|
| T | The target CsModel type to cast to before returning. |
Remarks
This will always throw a NotImplementedException since it is a manual model.
IDotNetModel.ModelType
The type of dot net model that was loaded.
Declaration
DotNetModelType IDotNetModel.ModelType { get; }
Returns
| Type | Description |
|---|---|
| DotNetModelType |
IParent.Parent
The parent to the current model. This will be null since this is manual model.
Declaration
IDotNetModel IParent.Parent { get; }
Returns
| Type | Description |
|---|---|
| IDotNetModel |