Table of Contents

Class Meta2ClassesTransformation

Namespace
NMF.Models.Meta
Assembly
NMF.Models.MetaTransformation.dll

The transformation to transform an NMeta metamodel to code

public class Meta2ClassesTransformation : ReflectiveTransformation
Inheritance
Meta2ClassesTransformation
Inherited Members

Properties

DefaultNamespace

Gets or sets the default namespace for the generated code

public string DefaultNamespace { get; set; }

Property Value

string

Remarks

This value can only be set before the transformation is initialized

DefaultSystemImports

Gets the default imported system namespaces

public static IEnumerable<string> DefaultSystemImports { get; }

Property Value

IEnumerable<string>

ForceGeneration

Gets or sets a flag determing whether code should be generated regardless of existing code

public bool ForceGeneration { get; set; }

Property Value

bool

GenerateChangedEvents

If set, for every property a corresponding event with suffix Changed is generated that gets fired when the property has changed

public bool GenerateChangedEvents { get; set; }

Property Value

bool

GenerateChangingEvents

If set, for every property a corresponding event with suffix Changing is generated that gets fired when the property is changing

public bool GenerateChangingEvents { get; set; }

Property Value

bool

GenerateCollectionsAsElements

If set, all collection properties are rendered as elements

public bool GenerateCollectionsAsElements { get; set; }

Property Value

bool

GenerateForInputOnly

If set, the transformation only produces results for namespaces that have been explicitly been asked for

public bool GenerateForInputOnly { get; set; }

Property Value

bool

NamespaceMap

Gets the namespace assigned to a model URI

public Dictionary<Uri, string> NamespaceMap { get; }

Property Value

Dictionary<Uri, string>

OnlyNested

Gets or sets a value indicating whether only nested namespaces of an initial namespace should be in the code compile unit or all that are used

public bool OnlyNested { get; set; }

Property Value

bool

Remarks

This value can only be set before the transformation is initialized

SeparateImplementations

Gets or sets a value indicating whether to separate the class implementations, i.e. create a public interface or not

public bool SeparateImplementations { get; set; }

Property Value

bool

Remarks

This value can only be set before the transformation is initialized

SystemImports

Gets the imported system namespaces

public virtual IEnumerable<string> SystemImports { get; }

Property Value

IEnumerable<string>

Methods

AddToCompileUnit(INamespace)

Gets a value indicating whether the given namespace should be added to the compile unit

protected virtual bool AddToCompileUnit(INamespace n)

Parameters

n INamespace

Returns

bool

CreateReference(IType, bool, ITransformationContext, bool)

Creates a reference to the given NMeta type

protected static CodeTypeReference CreateReference(IType type, bool isReference, ITransformationContext context, bool implementation = false)

Parameters

type IType

The NMeta type

isReference bool

A value indicating whether to default to IModelElement or object

context ITransformationContext

The transformation context

implementation bool

if true, a reference to the implementation is returned, otherwise a reference to the interface

Returns

CodeTypeReference

A code type reference

GetResourceKey(Model)

Gets the resource key for the given model element

protected virtual string GetResourceKey(Model model)

Parameters

model Model

The model for which to generate a resource key

Returns

string

The resource key of the model

IsValueType(IType)

Decides whether the given type is a value type

protected virtual bool IsValueType(IType type)

Parameters

type IType

The NMeta type

Returns

bool

True, if the type is represented as a value type. Override for more specifics on primitives