Reputation: 963
I know there is an example of code generation for asp.net mvc
Q1: I want to know how to map standard variables (which seem to be java specific) to .net folders in a solution.
# -------------------------------------------
# STANDARD VARIABLES
# -------------------------------------------
# --- Folders
SRC = src/main/java
RES = src/main/resources
WEB = src/main/webapp
TEST_SRC = src/test/java
TEST_RES = src/test/resources
DOC = doc
TMP = tmp
# --- Packages
ROOT_PKG = org.foo.bar
Q2: For multiple project solution like below in an abp.io based solution, do I need to create multiple telosys projects with a set of template bundles for each? How do I handle various paths for different projects in Telosys config files I would probably like to build a Visual Studio extension that would extract project folders and namespaces and modify programmatically telosys config files to match.
Here is an example of an open source asp.net core framework abp.io can have front end (in a project each): Angular, MVC Razor pages, Blazor,
It supports multiple DBs: Entity Framework, Dapper
Its solution structure is like this:
The content of the solution file is like this (pointing to individual project files which are in separate folders)
** Q3: How to have a metadata annotation to exclude an attribute in a list form or exclude it from editing**
Upvotes: 0
Views: 260
Reputation: 2460
Q1 answer :
Regarding the "standard variables" they are not specific for Java (only the example is for Java). You can use them as you want for any kind of target language. These variables are usually used in the "templates.cfg" file to define the folders where generated files will be located (their use is not mandatory).
By convention :
You can organize your project structure as you want
Example in a "templates.cfg" for C# ( only $SRC is used ) :
#--- Models
Entity class ; ${BEANNAME}.cs ; ${SRC}/Models/${BEANNAME} ; Models/Xxx_cs.vm ; *
Entity CreateViewModel ; Create${BEANNAME}ViewModel.cs ; ${SRC}/Models/${BEANNAME} ; Models/CreateXxxViewModel_cs.vm ; *
Entity UpdateViewModel ; Update${BEANNAME}ViewModel.cs ; ${SRC}/Models/${BEANNAME} ; Models/UpdateXxxViewModel_cs.vm ; *
#-- Controllers
Entity controller ; ${BEANNAME}sController.cs ; ${SRC}/Controllers ; Controllers/Xxxcontroller_cs.vm ; *
#-- Views
Index View ; Index.cshtml ; ${SRC}/Views/Home ; Views/Home/Index_cshtml.vm ; 1
List View ; List${BEANNAME}View.cshtml ; ${SRC}/Views/${BEANNAME}s ; Views/ListXxxView_cshtml.vm ; *
Create View ; Create${BEANNAME}View.cshtml ; ${SRC}/Views/${BEANNAME}s ; Views/CreateXxxView_cshtml.vm ; *
Update View ; Update${BEANNAME}View.cshtml ; ${SRC}/Views/${BEANNAME}s ; Views/UpdateXxxView_cshtml.vm ; *
Application Layout ; _Layout.cshtml ; ${SRC}/Views/Shared ; Views/Shared/_Layout_cshtml.vm ; 1
Q2 answer :
The simplest way is probably to have one Telosys project for each target project (to keep each project as small as possible).
But you can also create your own "global variables" and use them in a "big project" with a complex structure.
Example of specific variables definition (in "telosys-tools.cfg") :
ProjectVariable.MODULE_APPLICATION = my-app
ProjectVariable.MODULE_DOMAIN = my-domaine
ProjectVariable.MODULE_INFRASTRUCTURE = my-infrastructure
Example of usage in a "templates.cfg" file :
${MODULE_INFRASTRUCTURE}/${RES}/db
${MODULE_DOMAIN}/${SRC}/repository
${MODULE_APPLICATION}/${SRC}/handler
Upvotes: 1
Reputation: 2460
Q3 answer :
When you need a specific information for an attribute the simplest solution is to use a "tag".
You create any tag as you want (it's just a string starting with "#").
For example use "#exclude" tag for an attribute in the model :
comment : string { #exclude } ;
and use it in the template file :
#if ( ! $attribute.hasTag("exclude") )
use attribute here
#end
See : https://doc.telosys.org/dsl-model/tags
Upvotes: 0