Class NamespaceGenerator<T>
Represents a transformation rule that generates namespaces
public abstract class NamespaceGenerator<T> : TransformationRule<T, CodeNamespace> where T : classType Parameters
- T
- The model element type from which namespaces are being generated 
- Inheritance
- 
      
      
      
      
      
      NamespaceGenerator<T>
- Derived
- Inherited Members
Constructors
NamespaceGenerator()
Creates a new instance
protected NamespaceGenerator()Properties
AssembliesToCheck
Gets the assemblies in which to check for system name conflicts
protected virtual IEnumerable<Assembly> AssembliesToCheck { get; }Property Value
DefaultImports
Gets the default namespace imports in a derived class
public abstract IEnumerable<string> DefaultImports { get; }Property Value
Methods
CreateOutput(T, ITransformationContext)
Creates the uninitialized transformation rule output
public override CodeNamespace CreateOutput(T input, ITransformationContext context)Parameters
- inputT
- The input model element 
- contextITransformationContext
- The transformation context 
Returns
- CodeNamespace
- A blank code namespace with the correct name 
GetName(T)
Gets the name for the code namespace generated from the given model element
protected abstract string GetName(T input)Parameters
- inputT
- The input model element 
Returns
- string
- The name of the code namespace 
GetNamespaceConflictsIdentifier()
Gets the identifier for namespace conflicts
protected virtual object GetNamespaceConflictsIdentifier()Returns
- object
- An object that is used to obtain namespace conflicts 
IsNamespaceConflict(string, CodeNamespace)
Decides whether the given name causes a namespace conflict
protected virtual bool IsNamespaceConflict(string name, CodeNamespace ns)Parameters
- namestring
- The proposed name 
- nsCodeNamespace
- The namespace 
Returns
- bool
- True, if there is a namespace conflict so that the given name must be fully qualified, otherwise False 
IsSystemNameConflict(string, string)
Determines whether the given type name is a conflict with a system type
protected virtual bool IsSystemNameConflict(string typeName, string refNs)Parameters
Returns
IsValidName(string, CodeNamespace)
Decides whether the given name is a valid class name for a type
protected virtual bool IsValidName(string name, CodeNamespace ns)Parameters
- namestring
- The proposed name 
- nsCodeNamespace
- The proposed namespace 
Returns
- bool
- True if the name is valid, otherwise False 
RequireType<TType>(TransformationRuleBase<TType, CodeTypeDeclaration>, Func<T, TType>)
Creates a dependency that the given subsequent model element is transformed to a type
public ITransformationRuleDependency RequireType<TType>(TransformationRuleBase<TType, CodeTypeDeclaration> rule, Func<T, TType> selector) where TType : classParameters
- ruleTransformationRuleBase<TType, CodeTypeDeclaration>
- The transformation rule used to generate the type 
- selectorFunc<T, TType>
- A function selecting the correct subsequent model element 
Returns
- ITransformationRuleDependency
- The created transformation rule dependency 
Type Parameters
- TType
- The model element of the input type 
RequireTypes<TType>(TransformationRuleBase<TType, CodeTypeDeclaration>, Func<T, IEnumerable<TType>>)
Creates a dependency that the given subsequent model elements are transformed to types
public ITransformationRuleDependency RequireTypes<TType>(TransformationRuleBase<TType, CodeTypeDeclaration> rule, Func<T, IEnumerable<TType>> selector) where TType : classParameters
- ruleTransformationRuleBase<TType, CodeTypeDeclaration>
- The transformation rule used to generate the types 
- selectorFunc<T, IEnumerable<TType>>
- A function that selects the subsequent model elements 
Returns
- ITransformationRuleDependency
- The created transformation rule dependency 
Type Parameters
- TType
- The model elements input type 
Transform(T, CodeNamespace, ITransformationContext)
Initializes the generated code namespace
public override void Transform(T input, CodeNamespace output, ITransformationContext context)Parameters
- inputT
- The input model element 
- outputCodeNamespace
- The generated code namespace 
- contextITransformationContext
- The transformation context