CodeFactory for Windows CodeFactory for Windows
CodeFactory for Windows CodeFactory for Windows
CodeFactory

Search Results for

    Class GenerateCSharpCsPropertyExtensions

    Extension methods that support the generation of source in the C# language from the CsProperty model.

    Inheritance
    object
    GenerateCSharpCsPropertyExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: CodeFactory.WinVs.Models.CSharp
    Assembly: CodeFactory.WinVs.dll
    Syntax
    public static class GenerateCSharpCsPropertyExtensions

    Methods

    GenerateCSharpDefaultPropertySignature(CsProperty, NamespaceManager, List<MapNamespace>, bool, bool, CsSecurity, CsSecurity, CsSecurity, string, string)

    Generates a default property definition with no backing properties. Will determine security modifiers and append to get and set statements when needed.

    Declaration
    public static string GenerateCSharpDefaultPropertySignature(this CsProperty source, NamespaceManager manager = null, List<MapNamespace> mappedNamespaces = null, bool includeKeywords = false, bool includeAbstractKeyword = false, CsSecurity propertySecurity = CsSecurity.Unknown, CsSecurity setSecurity = CsSecurity.Unknown, CsSecurity getSecurity = CsSecurity.Unknown, string namePrefix = null, string nameSuffix = null)
    Parameters
    Type Name Description
    CsProperty source

    Property model used for generation.

    NamespaceManager manager

    Namespace manager used to format type names.This is an optional parameter.

    List<MapNamespace> mappedNamespaces

    Optional parameter that provides namespaces to be mapped to.

    bool includeKeywords

    Optional parameter that determines if the keywords will be appended. Default is false.

    bool includeAbstractKeyword

    Will include the definition for the abstract keyword in the definition if it is defined. default is false.

    CsSecurity propertySecurity

    Optional parameter that overrides the models property security and sets a new security access level.

    CsSecurity setSecurity

    Optional parameter that overrides the models set security level with a new access level. Will also define a set statement even if it is not defined.

    CsSecurity getSecurity

    Optional parameter that overrides the models get security level with a new access level. Will also define a get statement even if it is not defined.

    string namePrefix

    Optional prameter that determines if the name will have a prefix assigned to it, default is null.

    string nameSuffix

    Optional parameter that determines if the name will have a prefix assigned to it, default is null.

    Returns
    Type Description
    string

    Formatted property or null if model data was missing.

    Examples

    With Keywords [security] [keywords] [property type] [property name] { [get when used]; [set when used]; } No Keywords [security] [property type] [property name] { [get when used]; [set when used]; }

    GenerateCSharpDefaultValue(CsProperty)

    Property extension that returns the formatted C# syntax of either the name of the property or the method to get the default value of the property if it is nullable.

    Declaration
    public static string GenerateCSharpDefaultValue(this CsProperty source)
    Parameters
    Type Name Description
    CsProperty source

    Property to get the formatted C# syntax for.

    Returns
    Type Description
    string

    Formatted C# syntax to access a properties value.

    Exceptions
    Type Condition
    CodeFactoryException

    Raised if required information is missing to create the syntax.

    GenerateCSharpGetStatement(CsProperty, CsSecurity, CsSecurity)

    Extension method that generates the get statement of a property definition.

    Declaration
    public static string GenerateCSharpGetStatement(this CsProperty source, CsSecurity propertySecurity = CsSecurity.Unknown, CsSecurity getSecurity = CsSecurity.Unknown)
    Parameters
    Type Name Description
    CsProperty source

    the source property definition

    CsSecurity propertySecurity

    Optional parameter that defined the security used by the implementing property.

    CsSecurity getSecurity

    Optional parameter that allows you to set the get security level.

    Returns
    Type Description
    string

    Will return the formatted get statement or null if the property model is empty or the property does not support get.

    Examples

    With the same security [get] will return example: get With different security [security] [get] will return example: public get

    GenerateCSharpPropertyDeclaration(CsProperty, NamespaceManager, List<MapNamespace>, bool, bool, bool, CsSecurity, string, string)

    Generates the initial definition portion of a property.

    Declaration
    public static string GenerateCSharpPropertyDeclaration(this CsProperty source, NamespaceManager manager = null, List<MapNamespace> mappedNamespaces = null, bool includeSecurity = true, bool includeKeyWords = false, bool includeAbstractKeyword = false, CsSecurity propertySecurity = CsSecurity.Unknown, string namePrefix = null, string nameSuffix = null)
    Parameters
    Type Name Description
    CsProperty source

    The source property to use for formatting.

    NamespaceManager manager

    Namespace manager used to format type names.

    List<MapNamespace> mappedNamespaces

    Optional parameter that provides namespaces to be mapped to.

    bool includeSecurity

    Optional flag that determines if the security scope will be applied to the property definition. Default is true.

    bool includeKeyWords

    Optional flag that determines if keywords assigned to the property should be included in the signature. Default is false.

    bool includeAbstractKeyword

    Will include the definition for the abstract keyword in the definition if it is defined. default is false.

    CsSecurity propertySecurity

    Optional parameter to override the models security and set your own security.

    string namePrefix

    Optional prameter that determines if the name will have a prefix assigned to it, default is null.

    string nameSuffix

    Optional parameter that determines if the name will have a prefix assigned to it, default is null.

    Returns
    Type Description
    string

    The formatted signature or null if the model data was not loaded.

    Examples

    Format with Keywords [Security] [Keywords*] [ReturnType] [PropertyName] = public static string FirstName Format without Keywords [Security] [ReturnType] [PropertyName] = public string FirstName

    GenerateCSharpSetStatement(CsProperty, CsSecurity, CsSecurity)

    Extension method that generates the set statement of a property definition.

    Declaration
    public static string GenerateCSharpSetStatement(this CsProperty source, CsSecurity propertySecurity = CsSecurity.Unknown, CsSecurity setSecurity = CsSecurity.Unknown)
    Parameters
    Type Name Description
    CsProperty source

    the source property definition

    CsSecurity propertySecurity

    Optional parameter that defined the security used by the implementing property.

    CsSecurity setSecurity

    Optional parameter that allows you to set the set security level.

    Returns
    Type Description
    string

    Will return the formatted set statement or null if the property model is empty or the property does not support set.

    Examples

    With the same security [set] will return example: set With different security [security] [set] will return example: public set

    © CodeFactory, LLC. All rights reserved.