I just published a new step in this post series. The code can be downloaded from AppExampleStep05. The example:
At root folder, the example have the same three commands, as in the previous post.
GenerateCSharp.cmd
GenerateJava.cmd
GenerateVbNet.cmd
The model is the same. But I wrote new Tasks/GenerateCSharp.ajg, Tasks/GenerateVbNet.ajg. Now, you can generate a .NET solution and project. This is the GenerateCSharp.ajg:
IncludeCode "Utilities/Utilities.ajg" IncludeCode "Utilities/DotNetUtilities.ajg" ' Create Build Directories FileManager.CreateDirectory(Project.BuildDirectory) FileManager.CreateDirectory("${Project.BuildDirectory}") FileManager.CreateDirectory("${Project.BuildDirectory}/${Project.Name}.Entities") FileManager.CreateDirectory("${Project.BuildDirectory}/${Project.Name}.Entities/Properties") Project.Solution = CreateObject() Project.Solution.Guid = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC" Project.Solution.WebGuid = "E24C65DC-7377-472B-9ABA-BC803B73C61A" Project.Solution.Projects = CreateList() PrjEntities = CreateObject() PrjEntities.Name = "${Project.Name}.Entities" PrjEntities.Directory = "${Project.BuildDirectory}/${Project.Name}.Entities" PrjEntities.Includes = CreateList() PrjEntities.Projects = CreateList() PrjEntities.Libraries = CreateList() PrjEntities.Guid = CreateGuid() PrjEntities.COMGuid = CreateGuid() Project.Solution.Projects.Add(PrjEntities) for each Entity in Project.Model.Entities TransformerManager.Transform("Templates/CSharp/EntityClass.tpl", "${Project.BuildDirectory}/${Project.Name}.Entities/${Entity.Name}.cs", Environment) PrjEntities.Includes.Add(CreateFileCs("${Entity.Name}")) end for for each CsProject in Project.Solution.Projects TransformerManager.Transform("Templates/CSharp/CsProject.tpl", "${CsProject.Directory}/${CsProject.Name}.csproj", Environment) TransformerManager.Transform("Templates/CSharp/AssemblyInfoCs.tpl", "${CsProject.Directory}/Properties/AssemblyInfo.cs", Environment) end for TransformerManager.Transform("Templates/CSharp/Solution.tpl", "${Project.BuildDirectory}/${Project.Name}.sln", Environment)Lot of new things! But the point is: now, I generate a solution file, and a project file. There are new files with utilities, and new templates. Note the creation of Project.Solution dynamic object, and PrjEntities.
The solution generated in C#:
![]()
A solution and project is generate for Vb.NET, too:
![]()
Next steps: don't generate again files that not changed since last time;' able to have manual code in projects and keep them; new projects (persistence, web interface, …)
Keep tuned!
Angel “Java” Lopez
http://www.ajlopez.com