diff --git a/NitroNet.CastleWindsorModules/DefaultCastleWindsorModule.cs b/NitroNet.CastleWindsorModules/DefaultCastleWindsorModule.cs index 7e22938..7fac0e5 100644 --- a/NitroNet.CastleWindsorModules/DefaultCastleWindsorModule.cs +++ b/NitroNet.CastleWindsorModules/DefaultCastleWindsorModule.cs @@ -1,6 +1,7 @@ using System.Web; using Castle.MicroKernel.Registration; using Castle.Windsor; +using NitroNet.ModelBuilder; using NitroNet.Mvc; using NitroNet.ViewEngine; using NitroNet.ViewEngine.Cache; @@ -33,6 +34,7 @@ protected virtual void RegisterConfiguration(IWindsorContainer container) var config = ConfigurationLoader.LoadNitroConfiguration(_basePath); container.Register(Component.For().Instance(config)); container.Register(Component.For().Instance(new FileSystem(_basePath, config))); + container.Register(Component.For().Instance(new ModelBuilderController(new ModelBuilder.ModelBuilder(_basePath, config)))); } protected virtual void RegisterApplication(IWindsorContainer container) diff --git a/NitroNet.CastleWindsorModules/NitroNet.CastleWindsorModules.csproj b/NitroNet.CastleWindsorModules/NitroNet.CastleWindsorModules.csproj index cd1969d..f9fb55b 100644 --- a/NitroNet.CastleWindsorModules/NitroNet.CastleWindsorModules.csproj +++ b/NitroNet.CastleWindsorModules/NitroNet.CastleWindsorModules.csproj @@ -64,6 +64,10 @@ {5e84d392-7825-4449-89a2-9c1b8e376cae} NitroNet.Common + + {66126cd2-8a91-49f9-881f-053ab13628b7} + NitroNet.ModelBuilder + {b91e9371-631f-4f33-ad32-2b78724c85d3} NitroNet.Mvc diff --git a/NitroNet.ModelBuilder/BuilderModelResources.Designer.cs b/NitroNet.ModelBuilder/BuilderModelResources.Designer.cs new file mode 100644 index 0000000..cbd7f02 --- /dev/null +++ b/NitroNet.ModelBuilder/BuilderModelResources.Designer.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NitroNet.ModelBuilder { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class BuilderModelResources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal BuilderModelResources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NitroNet.ModelBuilder.BuilderModelResources", typeof(BuilderModelResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to <html> + /// + ///<body> + /// <h1>NitroNet Modelbuilder!</h1> + ///</body> + /// + ///</html>. + /// + internal static string index { + get { + return ResourceManager.GetString("index", resourceCulture); + } + } + } +} diff --git a/NitroNet.ModelBuilder/BuilderModelResources.resx b/NitroNet.ModelBuilder/BuilderModelResources.resx new file mode 100644 index 0000000..4055c88 --- /dev/null +++ b/NitroNet.ModelBuilder/BuilderModelResources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Resources\index.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + \ No newline at end of file diff --git a/NitroNet.ModelBuilder/IModelBuilder.cs b/NitroNet.ModelBuilder/IModelBuilder.cs new file mode 100644 index 0000000..2d83f2e --- /dev/null +++ b/NitroNet.ModelBuilder/IModelBuilder.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NitroNet.ModelBuilder +{ + public interface IModelBuilder + { + void GenerateModels(); + } +} diff --git a/NitroNet.ModelBuilder/ModelBuilder.cs b/NitroNet.ModelBuilder/ModelBuilder.cs new file mode 100644 index 0000000..9cfd4e2 --- /dev/null +++ b/NitroNet.ModelBuilder/ModelBuilder.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Text; +using System.Web.Hosting; +using NitroNet.ViewEngine.Config; +using NitroNet.ViewEngine.IO; +using NJsonSchema; +using NJsonSchema.CodeGeneration.CSharp; + +namespace NitroNet.ModelBuilder +{ + public class ModelBuilder : IModelBuilder + { + private readonly INitroNetConfig _nitronetConfig; + private readonly string _basePath; + private readonly string _modelNamespace; + private readonly bool _generateSingleFile; + private readonly string _absoluteGenerationPath; + + public ModelBuilder(string basePath, INitroNetConfig configuration) + { + var relativeGenerationPath = ConfigurationManager.AppSettings["NitroNet.Generation.Path"] ?? "Models"; + var generateSingleFileString = ConfigurationManager.AppSettings["NitroNet.Generation.SingleFile"] ?? "true"; + + _nitronetConfig = configuration; + _basePath = basePath; + _modelNamespace = ConfigurationManager.AppSettings["NitroNet.ModelNamespace"] ?? "NitroNet.Models"; + _generateSingleFile = !generateSingleFileString.Equals("false", StringComparison.InvariantCultureIgnoreCase); + _absoluteGenerationPath = PathInfo.Combine(PathInfo.Create(HostingEnvironment.MapPath("~/")), PathInfo.Create(relativeGenerationPath)).ToString(); + } + + public void GenerateModels() + { + var fileList = GetAllFiles(); + var schemaList = GetAllSchemas(fileList); + + GenerateModels(schemaList); + } + + private void GenerateModels(IEnumerable schemaList) + { + var oneFileText = new StringBuilder(); + + foreach (var schema in schemaList) + { + // TODO: Override the TypeNameGenerator? I dont like anonymous classes... + var generator = new CSharpGenerator(schema.Schema); + generator.Settings.Namespace = schema.Namespace; + generator.Settings.ClassStyle = CSharpClassStyle.Poco; + generator.Settings.GenerateDataAnnotations = schema.ShouldGenerateDataAnnotation; + generator.Settings.HandleReferences = true; + + var dataFileString = generator.GenerateFile($"{schema.ClassName}Model"); + + if (!Directory.Exists(_absoluteGenerationPath)) + { + Directory.CreateDirectory(_absoluteGenerationPath); + } + + if (!_generateSingleFile) + { + File.WriteAllText($"{_absoluteGenerationPath}\\{schema.ClassName}Model.cs", dataFileString); + } + else + { + oneFileText.Append(dataFileString); + } + } + + if (_generateSingleFile) + { + File.WriteAllText($"{_absoluteGenerationPath}\\NitroNetModels.cs", oneFileText.ToString()); + } + } + + private IEnumerable GetAllSchemas(IEnumerable fileList) + { + var schemaList = new List(); + // TODO: Add definitions and References to the Schema + foreach (var jsonFile in fileList) + { + var model = new SchemaModel + { + ClassName = jsonFile.Name.Replace(jsonFile.Extension, string.Empty), + Namespace = GenerateNamespace(jsonFile) + }; + + var jsonData = File.ReadAllText(jsonFile.FullName); + JsonSchema4 schema; + + var generateDataAnnotations = false; + + if (jsonFile.Name.Equals("schema.json", StringComparison.InvariantCultureIgnoreCase)) + { + schema = JsonSchema4.FromJsonAsync(jsonData).Result; + model.ClassName = $"Base{FirstLetterToUpper(jsonFile.Directory.Name)}"; + generateDataAnnotations = true; + } + else + { + schema = JsonSchema4.FromData(jsonData); + } + + model.Schema = schema; + schema.AllowAdditionalItems = true; + schema.AllowAdditionalProperties = true; + model.ShouldGenerateDataAnnotation = generateDataAnnotations; + schemaList.Add(model); + } + + return schemaList; + } + + private string GenerateNamespace(FileSystemInfo jsonFile) + { + if(jsonFile == null) + { + return _modelNamespace; + } + + var classNamespace = jsonFile.FullName.Replace(jsonFile.Name, string.Empty).Replace(_basePath.Replace("/", "\\"), string.Empty).Replace("/", ".").Replace("\\", ".").Replace("..", ".").Replace("_data", string.Empty); + return PrettifyNamespace($"{_modelNamespace.TrimEnd('.')}.{classNamespace.TrimStart('.')}".TrimEnd('.').Replace("-", "_")); + } + + private string PrettifyNamespace(string baseNamespace) + { + if(string.IsNullOrEmpty(baseNamespace)) + { + return baseNamespace; + } + + var prettyNamespaceSplitted = baseNamespace.Split('.'); + var prettyNamespace = new StringBuilder(); + foreach (var segment in prettyNamespaceSplitted) + { + prettyNamespace.Append($"{FirstLetterToUpper(segment)}."); + } + + return prettyNamespace.ToString().TrimEnd('.'); + } + + private List GetAllFiles() + { + var fileList = new List(); + + try + { + foreach (var componentPath in _nitronetConfig.ComponentPaths) + { + var fullpath = $"{_basePath.TrimEnd('/')}/{componentPath}"; + + fileList.AddRange(DirSearch(fullpath)); + } + } + catch (Exception ex) + { + Console.WriteLine(ex); + throw; + } + + return fileList; + } + + private string FirstLetterToUpper(string str) + { + if (str == null) + return null; + + if (str.Length > 1) + return char.ToUpper(str[0]) + str.Substring(1); + + return str.ToUpper(); + } + + private IEnumerable DirSearch(string sDir) + { + try + { + var fileList = new List(); + foreach (string d in Directory.GetDirectories(sDir)) + { + foreach (string f in Directory.GetFiles(d, "*.json")) + { + fileList.Add(new FileInfo(f)); + } + fileList.AddRange(DirSearch(d)); + } + + return fileList; + } + catch (Exception excpt) + { + Console.WriteLine(excpt.Message); + return new List(); + } + } + } +} diff --git a/NitroNet.ModelBuilder/ModelBuilderController.cs b/NitroNet.ModelBuilder/ModelBuilderController.cs new file mode 100644 index 0000000..bfdb9b9 --- /dev/null +++ b/NitroNet.ModelBuilder/ModelBuilderController.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Mvc; + +namespace NitroNet.ModelBuilder +{ + public class ModelBuilderController : Controller + { + private readonly IModelBuilder _modelBuilder; + public ModelBuilderController(IModelBuilder modelBuilder) + { + _modelBuilder = modelBuilder; + } + + public string Index() + { + return BuilderModelResources.index; + //return System.Text.Encoding.UTF8.GetString(file); + //return "TestService: " + _modelBuilder.ToString(); + } + + public string Generate() + { + var overrideAll = Request.QueryString["override"]; + _modelBuilder.GenerateModels(); + return "TestService: " + _modelBuilder.ToString(); + } + } +} diff --git a/NitroNet.ModelBuilder/NitroNet.ModelBuilder.csproj b/NitroNet.ModelBuilder/NitroNet.ModelBuilder.csproj new file mode 100644 index 0000000..5d2f16f --- /dev/null +++ b/NitroNet.ModelBuilder/NitroNet.ModelBuilder.csproj @@ -0,0 +1,110 @@ + + + + + Debug + AnyCPU + {66126CD2-8A91-49F9-881F-053AB13628B7} + Library + Properties + NitroNet.ModelBuilder + NitroNet.ModelBuilder + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + True + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\packages\NJsonSchema.9.6.5\lib\net45\NJsonSchema.dll + + + ..\packages\NJsonSchema.CodeGeneration.9.6.5\lib\net451\NJsonSchema.CodeGeneration.dll + + + ..\packages\NJsonSchema.CodeGeneration.CSharp.9.6.5\lib\net451\NJsonSchema.CodeGeneration.CSharp.dll + + + + + + + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll + + + ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll + + + + + + + + + + True + True + BuilderModelResources.resx + + + + + + + + + + + {A2395B2D-F69E-420F-9534-E640DFE86138} + NitroNet.ViewEngine + + + + + ResXFileCodeGenerator + BuilderModelResources.Designer.cs + + + + + + + + + \ No newline at end of file diff --git a/NitroNet.ModelBuilder/NitroNetTypeNameGenerator.cs b/NitroNet.ModelBuilder/NitroNetTypeNameGenerator.cs new file mode 100644 index 0000000..ace3b5a --- /dev/null +++ b/NitroNet.ModelBuilder/NitroNetTypeNameGenerator.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NJsonSchema; + +namespace NitroNet.ModelBuilder +{ + public class NitroNetTypeNameGenerator : ITypeNameGenerator + { + public string Generate(JsonSchema4 schema, string typeNameHint, IEnumerable reservedTypeNames) + { + throw new NotImplementedException(); + } + } +} diff --git a/NitroNet.ModelBuilder/Properties/AssemblyInfo.cs b/NitroNet.ModelBuilder/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1ffad5a --- /dev/null +++ b/NitroNet.ModelBuilder/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NitroNet.ModelBuilder")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Namics AG")] +[assembly: AssemblyProduct("NitroNet.ModelBuilder")] +[assembly: AssemblyCopyright("Copyright © Namics AG 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("66126cd2-8a91-49f9-881f-053ab13628b7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NitroNet.ModelBuilder/Resources/index.html b/NitroNet.ModelBuilder/Resources/index.html new file mode 100644 index 0000000..52636d9 --- /dev/null +++ b/NitroNet.ModelBuilder/Resources/index.html @@ -0,0 +1,7 @@ + + + +

NitroNet Modelbuilder!

+ + + \ No newline at end of file diff --git a/NitroNet.ModelBuilder/SchemaModel.cs b/NitroNet.ModelBuilder/SchemaModel.cs new file mode 100644 index 0000000..ec27c9c --- /dev/null +++ b/NitroNet.ModelBuilder/SchemaModel.cs @@ -0,0 +1,12 @@ +using NJsonSchema; + +namespace NitroNet.ModelBuilder +{ + internal class SchemaModel + { + public JsonSchema4 Schema { get; set; } + public string ClassName { get; set; } + public string Namespace { get; set; } + public bool ShouldGenerateDataAnnotation { get; set; } + } +} diff --git a/NitroNet.ModelBuilder/app.config b/NitroNet.ModelBuilder/app.config new file mode 100644 index 0000000..8460dd4 --- /dev/null +++ b/NitroNet.ModelBuilder/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/NitroNet.ModelBuilder/packages.config b/NitroNet.ModelBuilder/packages.config new file mode 100644 index 0000000..0cf608b --- /dev/null +++ b/NitroNet.ModelBuilder/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/NitroNet.UnityModules/DefaultUnityModule.cs b/NitroNet.UnityModules/DefaultUnityModule.cs index 5c57f10..a11630b 100644 --- a/NitroNet.UnityModules/DefaultUnityModule.cs +++ b/NitroNet.UnityModules/DefaultUnityModule.cs @@ -1,5 +1,6 @@ using System.Web; using Microsoft.Practices.Unity; +using NitroNet.ModelBuilder; using NitroNet.Mvc; using NitroNet.ViewEngine; using NitroNet.ViewEngine.Cache; @@ -31,7 +32,7 @@ protected virtual void RegisterConfiguration(IUnityContainer container) { var config = ConfigurationLoader.LoadNitroConfiguration(_basePath); container.RegisterInstance(config); - + container.RegisterInstance(new ModelBuilderController(new ModelBuilder.ModelBuilder(_basePath, config))); container.RegisterInstance(new FileSystem(_basePath, config)); } @@ -48,6 +49,7 @@ protected virtual void RegisterApplication(IUnityContainer container) container.RegisterType(new ContainerControlledLifetimeManager()); container.RegisterType( new ContainerControlledLifetimeManager()); + } } } diff --git a/NitroNet.UnityModules/NitroNet.UnityModules.csproj b/NitroNet.UnityModules/NitroNet.UnityModules.csproj index 6b298e1..366a4e3 100644 --- a/NitroNet.UnityModules/NitroNet.UnityModules.csproj +++ b/NitroNet.UnityModules/NitroNet.UnityModules.csproj @@ -74,6 +74,10 @@ NitroNet.Common False
+ + {66126cd2-8a91-49f9-881f-053ab13628b7} + NitroNet.ModelBuilder + {b91e9371-631f-4f33-ad32-2b78724c85d3} NitroNet.Mvc diff --git a/NitroNet.sln b/NitroNet.sln index 8b4f80a..f7d6bd2 100644 --- a/NitroNet.sln +++ b/NitroNet.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NitroNet.Mvc", "NitroNet.Mvc\NitroNet.Mvc.csproj", "{B91E9371-631F-4F33-AD32-2B78724C85D3}" EndProject @@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NitroNet.Common", "NitroNet EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NitroNet.CastleWindsorModules", "NitroNet.CastleWindsorModules\NitroNet.CastleWindsorModules.csproj", "{3200CAEB-BB82-4F30-8714-58433B51AC26}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NitroNet.ModelBuilder", "NitroNet.ModelBuilder\NitroNet.ModelBuilder.csproj", "{66126CD2-8A91-49F9-881F-053AB13628B7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -87,6 +89,10 @@ Global {3200CAEB-BB82-4F30-8714-58433B51AC26}.Debug|Any CPU.Build.0 = Debug|Any CPU {3200CAEB-BB82-4F30-8714-58433B51AC26}.Release|Any CPU.ActiveCfg = Release|Any CPU {3200CAEB-BB82-4F30-8714-58433B51AC26}.Release|Any CPU.Build.0 = Release|Any CPU + {66126CD2-8A91-49F9-881F-053AB13628B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66126CD2-8A91-49F9-881F-053AB13628B7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66126CD2-8A91-49F9-881F-053AB13628B7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66126CD2-8A91-49F9-881F-053AB13628B7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -97,4 +103,7 @@ Global {53891204-B74C-4FEF-AF1F-7E3081E83582} = {BD778325-2F52-4ED1-9E3D-1164D749367F} {8E0FD9F2-77E0-4D4B-B241-9746B24E86B6} = {BD778325-2F52-4ED1-9E3D-1164D749367F} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {08BBDD39-EB64-44E6-B46E-571103A4DB4A} + EndGlobalSection EndGlobal