Class DotNetModelExtensions
Extension methods that support models that implement IDotNetModel
Inherited Members
Namespace: CodeFactory.DotNet
Assembly: CodeFactory.DotNet.dll
Syntax
public static class DotNetModelExtensions
Methods
| Improve this Doc View SourceFormatCSharpArraySignatureSyntax(IDotNetType)
Extension method that creates the array portion definition of a type definition in C# syntax.
Declaration
public static string FormatCSharpArraySignatureSyntax(this IDotNetType source)
Parameters
Type | Name | Description |
---|---|---|
IDotNetType | source | The source type to get the array information to format. |
Returns
Type | Description |
---|---|
string | The formatted array syntax for the target type, or null if no array data was provided in the type definition. |
FormatCSharpAttributeParametersSignatureSyntax(IReadOnlyList<IDotNetAttributeParameter>)
Extension method that creates the attributes parameters list for a attribute definition in c# syntax format.
Declaration
public static string FormatCSharpAttributeParametersSignatureSyntax(this IReadOnlyList<IDotNetAttributeParameter> source)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<IDotNetAttributeParameter> | source | THe source list of parameters to be created. |
Returns
Type | Description |
---|---|
string | The fully formatted parameters section of a attribute declaration. |
FormatCSharpAttributeParameterValueSignatureSyntax(IDotNetAttributeParameterValue)
Creates the implementation of an attribute value formatted for C#.
Declaration
public static string FormatCSharpAttributeParameterValueSignatureSyntax(this IDotNetAttributeParameterValue source)
Parameters
Type | Name | Description |
---|---|---|
IDotNetAttributeParameterValue | source | The source value to format. |
Returns
Type | Description |
---|---|
string | The formatted value, or null if the model does not exist. |
FormatCSharpAttributeSignatureSyntax(IDotNetAttribute)
Extension method that returns a full attribute declaration in the C# language format.
Declaration
public static string FormatCSharpAttributeSignatureSyntax(this IDotNetAttribute source)
Parameters
Type | Name | Description |
---|---|---|
IDotNetAttribute | source | The attribute toe generate the c# signature for. |
Returns
Type | Description |
---|---|
string |
FormatCSharpEnumTypeSyntax(IDotNetEnum, string)
Extension method that will lookup the enumeration type based on the provided value.
Declaration
public static string FormatCSharpEnumTypeSyntax(this IDotNetEnum source, string value)
Parameters
Type | Name | Description |
---|---|---|
IDotNetEnum | source | The target IDotNetEnum model to get the enumeration type from. |
string | value | The target numerical value to use to lookup the enumeration type. |
Returns
Type | Description |
---|---|
string | The fully qualified enumeration type or null if the enumeration type could not be found. |
FormatCSharpEnumValueSyntax(IDotNetEnum, string)
Extension method that will lookup the value of an enumeration by the enumeration type name.
Declaration
public static string FormatCSharpEnumValueSyntax(this IDotNetEnum source, string enumName)
Parameters
Type | Name | Description |
---|---|---|
IDotNetEnum | source | The target IDotNetEnum model to get the enumeration value from. |
string | enumName | The target numerical named item to use to lookup the enumeration value. |
Returns
Type | Description |
---|---|
string | The target enumeration value or null if it could not be found. |
FormatCSharpFullTypeName(IDotNetType)
Extension method that generates the fully qualified type name from the IDotNetType model in the C# format.
Declaration
public static string FormatCSharpFullTypeName(this IDotNetType source)
Parameters
Type | Name | Description |
---|---|---|
IDotNetType | source | The source type to get the full type name from. |
Returns
Type | Description |
---|---|
string | The fully qualified namespace and full type definition. Null if the type is missing or not loaded. |
FormatCSharpGenericSignatureSyntax(IReadOnlyList<IDotNetGenericParameter>)
Extension method that generates the generics definition part of a signature in the C# format.
Declaration
public static string FormatCSharpGenericSignatureSyntax(this IReadOnlyList<IDotNetGenericParameter> source)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<IDotNetGenericParameter> | source | The target types that make up the generics signature. |
Returns
Type | Description |
---|---|
string | The fully formatted definition of the generics signature, or null if the source is not provided. |
FormatCSharpGenericWhereClauseSyntax(IDotNetGenericParameter)
Extension method that generates the where clause for a generic parameter if one exists. This will not generate if the generic parameter is not a place holder type, or if no where clause conditions have been provided.
Declaration
public static string FormatCSharpGenericWhereClauseSyntax(this IDotNetGenericParameter source)
Parameters
Type | Name | Description |
---|---|---|
IDotNetGenericParameter | source | Generic parameter to generate the where clause from. |
Returns
Type | Description |
---|---|
string | Null if the where clause was not generated, or the C# syntax for the where clause. |
FormatCSharpParameterDefaultValueSyntax(IDotNetParameterDefaultValue, IDotNetType)
Extension method that generates the default value syntax for a parameter in the C# language.
Declaration
public static string FormatCSharpParameterDefaultValueSyntax(this IDotNetParameterDefaultValue source, IDotNetType type)
Parameters
Type | Name | Description |
---|---|---|
IDotNetParameterDefaultValue | source | The target default value to format. |
IDotNetType | type | The target type of the value to be formatted. |
Returns
Type | Description |
---|---|
string | The fully formatted syntax for the default value or null if data was missing. |
FormatCSharpParametersSignatureSyntax(IReadOnlyList<IDotNetParameter>)
Extension method that create the fully formatted parameters section in c# syntax.
Declaration
public static string FormatCSharpParametersSignatureSyntax(this IReadOnlyList<IDotNetParameter> source)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<IDotNetParameter> | source | The source list of parameters to be turned into a parameters signature. |
Returns
Type | Description |
---|---|
string | The fully formatted parameters signature or null if data was missing. |
FormatCSharpSyntax(DotNetSecurity)
Gets the security keyword for the C# language.
Declaration
public static string FormatCSharpSyntax(this DotNetSecurity source)
Parameters
Type | Name | Description |
---|---|---|
DotNetSecurity | source | The source security object to get the keyword from. |
Returns
Type | Description |
---|---|
string | The name of the security keyword or null. |
FormatCSharpTupleSignatureSyntax(IDotNetType)
Extension method that creates a C# signature for the tuple type.
Declaration
public static string FormatCSharpTupleSignatureSyntax(this IDotNetType source)
Parameters
Type | Name | Description |
---|---|---|
IDotNetType | source | The target declaration syntax for a tuple. |
Returns
Type | Description |
---|---|
string | The formatted tuple or null if data is missing. |
FormatCSharpValueSyntax(IDotNetType, string)
Extension method that returns a value declaration in the C# language format.
Declaration
public static string FormatCSharpValueSyntax(this IDotNetType source, string value)
Parameters
Type | Name | Description |
---|---|---|
IDotNetType | source | The target type to create the value definition for. |
string | value | The value to be formatted. |
Returns
Type | Description |
---|---|
string | The definition of the value formatted for C# |