Show / Hide Table of Contents

Class Compiler

Represents a compiler that can turn source schema into particular target script/schema, i.e. into database creation script for particular technology (i.e. Oracle, MySQL, PostgreSQL, etc..) or some other code/script (i.e. RecordModel classes, JavaScript classes)

Inheritance
System.Object
Compiler
RDBMSCompiler
Implements
IConfigurable
INamed
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NFX.RelationalModel
Assembly: NFX.dll
Syntax
public abstract class Compiler : IConfigurable, INamed

Constructors

Compiler(Schema)

Declaration
protected Compiler(Schema schema)
Parameters
Type Name Description
Schema schema

Fields

m_CompileErrors

Declaration
protected List<SchemaCompilationException> m_CompileErrors
Field Value
Type Description
System.Collections.Generic.List<SchemaCompilationException>

SCRIPT_COMMENT_ATTR

Specifies the comment that will be output for decorated entity in the script

Declaration
public const string SCRIPT_COMMENT_ATTR = "script-comment"
Field Value
Type Description
System.String

SCRIPT_INCLUDE_SECTION

Specifies the name of the file to be included in the output verbatim, i.e.: script-include="mytypes.txt"{}

Declaration
public const string SCRIPT_INCLUDE_SECTION = "script-include"
Field Value
Type Description
System.String

SCRIPT_OUTPUT_NAME_ATTR

Specifies the name of the output that script text has to be placed in

Declaration
public const string SCRIPT_OUTPUT_NAME_ATTR = "output-name"
Field Value
Type Description
System.String

SCRIPT_TEXT_SECTION

Specifies the text to be included in the output verbatim, i.e.: script-text="INSERT INTO TBL_ABC VALUES(1, true, now())"{}

Declaration
public const string SCRIPT_TEXT_SECTION = "script-text"
Field Value
Type Description
System.String

Properties

CompileErrors

Returns exception errors that were generated during compilation. This property returns "planned" errors that were caused by input, whereas CompileException returns exception that indicates some more drastic abnormality that broke the compilation

Declaration
public IEnumerable<SchemaCompilationException> CompileErrors { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<SchemaCompilationException>

CompileException

Returns exception that surfaced during compilation, or null if source has not compiled yet or no exception happened. This exception is different form CompileErrors because it indicates some un=planned condition that broke the compilation process

Declaration
public Exception CompileException { get; }
Property Value
Type Description
System.Exception

HasCompiled

Returns true to indicate that compiler has already processed the source schema

Declaration
public bool HasCompiled { get; }
Property Value
Type Description
System.Boolean

HasErrors

Returns true when this instance did not compile properly

Declaration
public bool HasErrors { get; }
Property Value
Type Description
System.Boolean

Name

Returns the name of the technology that this compiler targets. i.e. "ORACLE", "RecordModel"

Declaration
public abstract string Name { get; }
Property Value
Type Description
System.String

NameCaseSensitivity

Determines whether output script is case sensitive

Declaration
[Config("$name-case-sensitivity|$case-sensitivity")]
public virtual NameCaseSensitivity NameCaseSensitivity { get; set; }
Property Value
Type Description
NameCaseSensitivity

NameComparison

Returns string comparison options for names that depend on target case sensitivity

Declaration
public StringComparison NameComparison { get; }
Property Value
Type Description
System.StringComparison

OutputPath

Determines where compiled output is placed

Declaration
[Config("$out-path")]
public string OutputPath { get; set; }
Property Value
Type Description
System.String

OutputPrefix

Determines the prefix for output names

Declaration
[Config("$out-name-prefix")]
public string OutputPrefix { get; set; }
Property Value
Type Description
System.String

Schema

Returns source schema

Declaration
public Schema Schema { get; }
Property Value
Type Description
Schema

Target

Returns type of target that this instance produces output for

Declaration
public abstract TargetType Target { get; }
Property Value
Type Description
TargetType

Methods

BuildNodeOutput(IConfigSectionNode, Compiler.Outputs)

Override to perform custom interpretation per particular compiler target

Declaration
protected abstract void BuildNodeOutput(IConfigSectionNode node, Compiler.Outputs outputs)
Parameters
Type Name Description
IConfigSectionNode node
Compiler.Outputs outputs

BuildOutputs(Compiler.Outputs)

Override to perform compilation into output, the base implementation loops over all nodes and interprets script includes

Declaration
protected virtual void BuildOutputs(Compiler.Outputs outputs)
Parameters
Type Name Description
Compiler.Outputs outputs

Compile()

Declaration
public void Compile()

Configure(IConfigSectionNode)

Declaration
public void Configure(IConfigSectionNode node)
Parameters
Type Name Description
IConfigSectionNode node

DoCompile()

Performs a compilation - this is a root override-able method where compilation starts

Declaration
protected virtual void DoCompile()

EnsureNotCompiled()

Declaration
protected void EnsureNotCompiled()

EscapeFileName(String)

Replaces incompatible characters for file names with "_"

Declaration
public string EscapeFileName(string fn)
Parameters
Type Name Description
System.String fn
Returns
Type Description
System.String

EscapeString(String)

Declaration
public virtual string EscapeString(string str)
Parameters
Type Name Description
System.String str
Returns
Type Description
System.String

GetOutputFileSuffix(String)

Override to provide meaningful extension for particular technology, i.e. SQL

Declaration
public virtual string GetOutputFileSuffix(string outputName)
Parameters
Type Name Description
System.String outputName
Returns
Type Description
System.String

IncludeScriptFile(IConfigSectionNode, Compiler.Outputs)

Performs a script file include

Declaration
protected virtual void IncludeScriptFile(IConfigSectionNode node, Compiler.Outputs outputs)
Parameters
Type Name Description
IConfigSectionNode node
Compiler.Outputs outputs

IncludeScriptText(IConfigSectionNode, Compiler.Outputs)

Performs a verbatim script text include

Declaration
public virtual void IncludeScriptText(IConfigSectionNode node, Compiler.Outputs outputs)
Parameters
Type Name Description
IConfigSectionNode node
Compiler.Outputs outputs

Implements

IConfigurable
INamed

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX