I am working with telosys 4.2.0 in C#. I have added 7 c# templates in csharp-bundle:
Entity class;${BEANNAME}.cs;Models;entity_cs.vm;*
Controller;${BEANNAME}Controller.cs;Controllers;controller_cs.vm;*
Service;${BEANNAME}Service.cs;Services;service_cs.vm;*
Interface;IGenericRepository.cs;Repositories;igenericrepository_cs.vm;
Repository;Repository.cs;Repositories;repository_cs.vm;
UnitOfWork;UnitOfWork.cs;UnitOfWork;unitofwork_cs.vm;
Interface;IUnitOfWork.cs;UnitOfWork;iunitofwork_cs.vm;
Last four template config are not entity specific. I want them to generate only once. If I run "gen Product *" it generates 7 files. Is there any way, for new entity, if I run "gen Order *" last 4 template classes won't overwrite.
Additionally * target is not behaving as expected. 3 templates are flagged with *, and last 4 missing * target. But "gen Product *" generating all 7 templates classes.
I am able to generate a single class using "gen Product UnitOfWork.vm". But is there any -ifnew flag present in telosys 4.2.0 to skip existing classes' generation while using "gen Product *" or "gen * *"?
I am working with telosys 4.2.0 in C#. I have added 7 c# templates in csharp-bundle:
Entity class;${BEANNAME}.cs;Models;entity_cs.vm;*
Controller;${BEANNAME}Controller.cs;Controllers;controller_cs.vm;*
Service;${BEANNAME}Service.cs;Services;service_cs.vm;*
Interface;IGenericRepository.cs;Repositories;igenericrepository_cs.vm;
Repository;Repository.cs;Repositories;repository_cs.vm;
UnitOfWork;UnitOfWork.cs;UnitOfWork;unitofwork_cs.vm;
Interface;IUnitOfWork.cs;UnitOfWork;iunitofwork_cs.vm;
Last four template config are not entity specific. I want them to generate only once. If I run "gen Product *" it generates 7 files. Is there any way, for new entity, if I run "gen Order *" last 4 template classes won't overwrite.
Additionally * target is not behaving as expected. 3 templates are flagged with *, and last 4 missing * target. But "gen Product *" generating all 7 templates classes.
I am able to generate a single class using "gen Product UnitOfWork.vm". But is there any -ifnew flag present in telosys 4.2.0 to skip existing classes' generation while using "gen Product *" or "gen * *"?
Share Improve this question edited Mar 26 at 12:57 saibin asked Mar 26 at 12:17 saibinsaibin 254 bronze badges1 Answer
Reset to default 2If you want a template to be executed only once (not for all entities)
add "1" at the end instead of "*"
Example:
; _Layout.cshtml ; ${SRC}/Views/Shared ; Views/Shared/_Layout_cshtml.vm ;
1
If you don't want to rewrite a target file if it already exists
add this directive at the beginning of your template :
#if($target.outputFileExists() )#cancel("File already exists")#end