-
Notifications
You must be signed in to change notification settings - Fork 1
Code Generation
The purpose of KAlliope is to support convention-based and template-based code generation. Multiple templating engines are available in the .NET ecosystem such as DotLiquid and Handlebars.NET. More temaplating engines exist and of course they can be used as well, the reason to use one is basicaly determined by "what you like best".
A part of the Kalliope library has been code-generated using DotLiquid, read more about it [here|Kalliope-Code-Generation]
Codegeneration can be used to generate anything that is relevant to your project, it can include generation of the following kinds of concepts:
- HTML
- C# code such as classes, interfaces, enumerations, structs, etc.
- XML Schema
- SQL Schema, SQL queries, etc
- Graph Schema and Graph queries such as Cypher, SPARQL, etc.
- Object Relational Mappings (not to be confused with Object Role Modelling)
The first step in code generation is to read an ORM model and to have it available as an object graph in memory. This is done using the OrmFileReader
. The following code-snippet demonstrates how this is done:
var ormXmlReader = new OrmXmlReader();
var fileReader = new OrmFileReader
{
OrmXmlReader = ormXmlReader
};
var path = "path-to-an-orm-model";
fileReader.Read(path);
var cache = this.fileReader.Assembler.Cache;
Lazy<Kalliope.Core.ModelThing> lazyPoco;
cache.TryGetValue("root:unique-identifier-of-the-root-model-entity", out lazyPoco);
var ormRoot = (Kalliope.OrmRoot)lazyPoco.Value;
The ormRoot
variable in the above code-snippet is the ORM Model class which provides access to the content of the model such all the EntityType
s, ValueType
s, etc.
MORE COMING SOON
MORE COMING SOON
copyright @ Starion Group S.A.