// If HasInterfaces
        public static IGAssemblyGroupBasicConstructorResult MAssemblyGroupBasicConstructor(string gAssemblyGroupName                = default,
                                                                                           string subDirectoryForGeneratedFiles     = default, string baseNamespaceName = default, bool hasInterfaces = true,
                                                                                           IGPatternReplacement gPatternReplacement = default)
        {
            var _gPatternReplacement =
                gPatternReplacement == default ? new GPatternReplacement() : gPatternReplacement;

            #region Determine the names of the Titular Base and Derived CompilationUnits, Namespaces, Classes
            // everything to the right of the last "." character, returns original string if no "."
            var pos = gAssemblyGroupName.LastIndexOf(".") + 1;
            var gTitularCommonName                 = gAssemblyGroupName.Substring(pos, gAssemblyGroupName.Length - pos);
            var gTitularAssemblyUnitName           = gAssemblyGroupName;
            var gNamespaceName                     = $"{baseNamespaceName}{gTitularCommonName}";
            var gCompilationUnitCommonName         = gTitularCommonName;
            var gTitularDerivedCompilationUnitName = gCompilationUnitCommonName;
            var gTitularBaseCompilationUnitName    = gCompilationUnitCommonName + "Base";
            var gClassDerivedName                  = gCompilationUnitCommonName;
            var gClassBaseName                     = gCompilationUnitCommonName + "Base";
            #endregion
            // If HasInterfaces

            #region Determine the names TitularInterfaces Base and Derived CompilationUnits, Namespaces, Classes
            var gTitularInterfaceAssemblyUnitName           = gAssemblyGroupName + ".Interfaces";
            var gTitularInterfaceDerivedCompilationUnitName = "I" + gCompilationUnitCommonName;
            var gTitularInterfaceBaseCompilationUnitName    = "I" + gCompilationUnitCommonName + "Base";
            var gTitularInterfaceDerivedName = "I" + gCompilationUnitCommonName;
            var gTitularInterfaceBaseName    = "I" + gCompilationUnitCommonName + "Base";
            #endregion
            #region GReplacementPatternDictionary for gAssemblyGroup
            var gAssemblyGroupPatternReplacement = new GPatternReplacement(gName: "gAssemblyGroupPatternReplacement",
                                                                           gDictionary: new Dictionary <Regex, string>()
            {
                { new Regex("AssemblyGroupNameReplacementPattern"), gAssemblyGroupName },
            });
            // add the PatternReplacements specified as the gPatternReplacement argument
            foreach (var kvp in gPatternReplacement.GDictionary)
            {
                gAssemblyGroupPatternReplacement.GDictionary.Add(kvp.Key, kvp.Value);
            }
            #endregion
            #region Instantiate the GAssemblyGroup
            var gAssemblyGroup =
                new GAssemblyGroup(gName: gAssemblyGroupName, gPatternReplacement: gAssemblyGroupPatternReplacement);
            #endregion
            #region Titular AssemblyUnit
            #region GReplacementPatternDictionary for the Titular AssemblyUnit
            var gTitularAssemblyUnitPatternReplacement = new GPatternReplacement(gName: "gAssemblyUnitPatternReplacement",
                                                                                 gDictionary: new Dictionary <Regex, string>()
            {
                { new Regex("AssemblyUnitNameReplacementPattern"), gTitularAssemblyUnitName }
            });
            // add the AssemblyGroup PatternReplacements to the Titular AssemblyUnit PatternReplacements
            gTitularAssemblyUnitPatternReplacement.GDictionary.AddRange(gAssemblyGroupPatternReplacement.GDictionary);
            #endregion
            #region ProjectUnit for the Titular AssemblyUnit
            #region GPatternReplacement for the ProjectUnit
            var gTitularAssemblyUnitProjectUnitPatternReplacement =
                new GPatternReplacement(gName: "TitularAssemblyUnitProjectUnitPatternReplacement");
            gTitularAssemblyUnitProjectUnitPatternReplacement.GDictionary.AddRange(
                gTitularAssemblyUnitPatternReplacement.GDictionary);
            #endregion
            var gTitularAssemblyUnitProjectUnit = new GProjectUnit(gName: gTitularAssemblyUnitName,
                                                                   gPatternReplacement: gTitularAssemblyUnitProjectUnitPatternReplacement);
            #endregion
            #region Instantiate the gTitularAssemblyUnit
            var gTitularAssemblyUnit = new GAssemblyUnit(gName: gTitularAssemblyUnitName,
                                                         gRelativePath: gTitularAssemblyUnitName,
                                                         gProjectUnit: gTitularAssemblyUnitProjectUnit,
                                                         gPatternReplacement: gTitularAssemblyUnitPatternReplacement);
            #endregion
            #endregion
            gAssemblyGroup.GAssemblyUnits.Add(gTitularAssemblyUnit.Philote, gTitularAssemblyUnit);
            #region Titular Derived CompilationUnit
            #region Pattern Replacements for Titular Derived CompilationUnit
            var gTitularDerivedCompilationUnitPatternReplacement = new GPatternReplacement(gName: "GTitularDerivedCompilationUnitPatternReplacement",
                                                                                           gDictionary: new Dictionary <Regex, string>()
            {
                { new Regex("CompilationUnitNameReplacementPattern"), gTitularDerivedCompilationUnitName },
                //{new Regex("DataInitializationReplacementPattern"), tempdatainitialization},
                //{new Regex("DataDisposalReplacementPattern"), ""
                //  // "SubscriptionToConsoleReadLineAsyncAsObservableDisposeHandle.Dispose();"
                //},
            });
            // add the AssemblyUnit PatternReplacements to the Derived CompilationUnit PatternReplacements
            gTitularDerivedCompilationUnitPatternReplacement.GDictionary.AddRange(gTitularAssemblyUnitPatternReplacement
                                                                                  .GDictionary);
            #endregion
            #region Instantiate the Titular Derived CompilationUnit
            var gTitularDerivedCompilationUnit = new GCompilationUnit(gTitularDerivedCompilationUnitName, gFileSuffix: ".cs",
                                                                      gRelativePath: subDirectoryForGeneratedFiles, gPatternReplacement: gTitularDerivedCompilationUnitPatternReplacement);
            #endregion
            gTitularAssemblyUnit.GCompilationUnits.Add(gTitularDerivedCompilationUnit.Philote, gTitularDerivedCompilationUnit);
            #region Instantiate the gNamespaceDerived
            var gNamespaceDerived = new GNamespace(gNamespaceName);
            #endregion
            gTitularDerivedCompilationUnit.GNamespaces.Add(gNamespaceDerived.Philote, gNamespaceDerived);
            #region Instantiate the gClassDerived
            // If hasInterfaces, the derived class Implements the Interface
            GClass gClassDerived;
            if (hasInterfaces)
            {
                gClassDerived = new GClass(gClassDerivedName, "public", gAccessModifier: "partial",
                                           gInheritance: gClassBaseName,
                                           gImplements: new List <string> {
                    gTitularInterfaceDerivedName
                }
                                           //gDisposesOf: new List<string> { "CompilationUnitNameReplacementPatternDerivedData" }
                                           );
            }
            else
            {
                gClassDerived = new GClass(gClassDerivedName, "public", gAccessModifier: "partial",
                                           gInheritance: gClassBaseName
                                           //Implements: new List<string> {gTitularInterfaceDerivedName}  -- No Interfaces in this AssemblyGroup
                                           //gDisposesOf: new List<string> { "CompilationUnitNameReplacementPatternDerivedData" }
                                           );
            }

            #endregion
            gNamespaceDerived.GClasss.Add(gClassDerived.Philote, gClassDerived);
            #endregion

            #region Titular Base CompilationUnit
            #region Pattern Replacements for Derived CompilationUnit
            var gTitularBaseCompilationUnitPatternReplacement = new GPatternReplacement(gName: "GTitularBaseCompilationUnitPatternReplacement",
                                                                                        gDictionary: new Dictionary <Regex, string>()
            {
                { new Regex("CompilationUnitNameReplacementPattern"), gTitularBaseCompilationUnitName },
                //{new Regex("DataInitializationReplacementPattern"), tempdatainitialization}, {
                //  new Regex("DataDisposalReplacementPattern"),
                //  //"SubscriptionToConsoleReadLineAsyncAsObservableDisposeHandle.Dispose();"
                //  ""
                //},
            });
            // add the AssemblyUnit PatternReplacements to the Base CompilationUnit PatternReplacements
            foreach (var kvp in gTitularAssemblyUnitPatternReplacement.GDictionary)
            {
                gTitularBaseCompilationUnitPatternReplacement.GDictionary.Add(kvp.Key, kvp.Value);
            }
            #endregion
            #region Instantiate the Titular Base CompilationUnit
            var gTitularBaseCompilationUnit = new GCompilationUnit(gTitularBaseCompilationUnitName, gFileSuffix: ".cs",
                                                                   gRelativePath: subDirectoryForGeneratedFiles, gPatternReplacement: gTitularBaseCompilationUnitPatternReplacement);
            #endregion
            gTitularAssemblyUnit.GCompilationUnits.Add(gTitularBaseCompilationUnit.Philote, gTitularBaseCompilationUnit);
            #region Instantiate the gNamespaceBase
            var gNamespaceBase = new GNamespace(gNamespaceName);
            #endregion
            gTitularBaseCompilationUnit.GNamespaces.Add(gNamespaceBase.Philote, gNamespaceBase);
            #region Instantiate the gClassBase
            var gClassBase = new GClass(gClassBaseName, "public", gAccessModifier: "partial",
                                        //gInheritance: baseClass.GName
                                        // If HasInterfaces

                                        gImplements: new List <string> {
                gTitularInterfaceBaseName
            }                           //, "IDisposable"
                                        //gDisposesOf: new List<string> { "CompilationUnitNameReplacementPatternBaseData" }
                                        );
            #endregion
            gNamespaceBase.GClasss.Add(gClassBase.Philote, gClassBase);
            #region Instantiate the gPrimaryConstructorBase (Primary Constructor for the Titular Base Class)
            var gPrimaryConstructorBase = new GMethod(new GMethodDeclaration(gClassBaseName, isConstructor: true,
                                                                             gVisibility: "public"));
            #endregion
            gClassBase.GMethods.Add(gPrimaryConstructorBase.Philote, gPrimaryConstructorBase);
            #endregion
            //#region Data Initialization (startup?)
            //// ToDo: encapsulate and refactor
            //string tempdatainitialization = @"
            //  /*
            //  #region configurationRoot for this HostedService
            //  // Create the configurationBuilder for this HostedService. This creates an ordered chain of configuration providers. The first providers in the chain have the lowest priority, the last providers in the chain have a higher priority.
            //  // The Environment has been configured by the GenericHost before this point is reached
            //  // InitialStartupDirectory has been set by the GenericHost before this point is reached, and is where the GenericHost program or service was started
            //  // LoadedFromDirectory has been configured by the GenericHost before this point is reached. It is the location where this assembly resides
            //  // ToDo: Implement these two values into the GenericHost configurationRoot somehow, then remove from the constructor signature
            //  // var loadedFromDirectory = hostConfiguration.GetValue<string>(\SomeStringConstantConfigrootKey\ \./\); //ToDo suport dynamic assembly loading form other Startup directories -  Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            //  // var initialStartupDirectory = hostConfiguration.GetValue<string>(\SomeStringConstantConfigrootKey\ \./\);
            //  // Build the configurationRoot for this service
            //  // var configurationBuilder = ConfigurationExtensions.StandardConfigurationBuilder(loadedFromDirectory, initialStartupDirectory, ConsoleMonitorDefaultConfiguration.Production, ConsoleMonitorStringConstants.SettingsFileName, ConsoleMonitorStringConstants.SettingsFileNameSuffix, StringConstants.CustomEnvironmentVariablePrefix, LoggerFactory, stringLocalizerFactory, hostEnvironment, hostConfiguration, linkedCancellationToken);
            //  // ConfigurationRoot = configurationBuilder.Build();
            //  #endregion
            //  // Embedded object as Data
            //  //AssemblyUnitNameReplacementPatternBaseData = new AssemblyUnitNameReplacementPatternBaseData();
            //  */";
            //#endregion


            /* ************************************************************************************ */
            // If HasInterfaces

            #region Titular Interfaces AssemblyUnit
            #region GReplacementPatternDictionary for Titular Interfaces AssemblyUnit
            var gTitularInterfaceAssemblyUnitPatternReplacement = new GPatternReplacement(
                gDictionary: new Dictionary <Regex, string>()
            {
                { new Regex("AssemblyUnitNameReplacementPattern"), gTitularInterfaceAssemblyUnitName }
            });
            // add the AssemblyGroup PatternReplacements to the Titular Interface AssemblyUnit PatternReplacements
            gTitularInterfaceAssemblyUnitPatternReplacement.GDictionary.AddRange(gAssemblyGroupPatternReplacement.GDictionary);
            #endregion
            #region ProjectUnit for the Titular Interface AssemblyUnit
            #region GPatternReplacement for the ProjectUnit
            var gTitularInterfaceAssemblyUnitProjectUnitPatternReplacement =
                new GPatternReplacement(gName: "TitularInterfaceAssemblyUnitProjectUnitPatternReplacement");
            gTitularInterfaceAssemblyUnitProjectUnitPatternReplacement.GDictionary.AddRange(
                gTitularInterfaceAssemblyUnitPatternReplacement.GDictionary);
            #endregion
            var gTitularInterfaceAssemblyUnitProjectUnit = new GProjectUnit(gTitularInterfaceAssemblyUnitName,
                                                                            gPatternReplacement: gTitularInterfaceAssemblyUnitProjectUnitPatternReplacement);
            #endregion
            #region Instantiate the gTitularInterfaceAssemblyUnit
            var gTitularInterfaceAssemblyUnit = new GAssemblyUnit(gName: gTitularInterfaceAssemblyUnitName,
                                                                  gRelativePath: gTitularInterfaceAssemblyUnitName,
                                                                  gProjectUnit: gTitularInterfaceAssemblyUnitProjectUnit,
                                                                  gPatternReplacement: gTitularInterfaceAssemblyUnitPatternReplacement);
            #endregion
            gAssemblyGroup.GAssemblyUnits.Add(gTitularInterfaceAssemblyUnit.Philote, gTitularInterfaceAssemblyUnit);
            #region Titular Interface Derived CompilationUnit
            #region Pattern Replacements for Titular Interface Derived CompilationUnit
            var gInterfaceDerivedCompilationUnitPatternReplacement = new GPatternReplacement(gName: "gTitularInterfaceDerivedCompilationUnitPatternReplacement",
                                                                                             gDictionary: new Dictionary <Regex, string>()
            {
                { new Regex("CompilationUnitNameReplacementPattern"), gTitularInterfaceDerivedCompilationUnitName }
            });
            // add the interface AssemblyUnit PatternReplacements to the Interface Derived CompilationUnit PatternReplacements
            gInterfaceDerivedCompilationUnitPatternReplacement.GDictionary.AddRange(gTitularInterfaceAssemblyUnitPatternReplacement
                                                                                    .GDictionary);
            #endregion
            #region instantiate the Titular Interface Derived CompilationUnit
            var gTitularInterfaceDerivedCompilationUnit = new GCompilationUnit(gTitularInterfaceDerivedCompilationUnitName,
                                                                               gFileSuffix: ".cs",
                                                                               gRelativePath: subDirectoryForGeneratedFiles,
                                                                               gPatternReplacement: gInterfaceDerivedCompilationUnitPatternReplacement);
            #endregion
            gTitularInterfaceAssemblyUnit.GCompilationUnits.Add(gTitularInterfaceDerivedCompilationUnit.Philote,
                                                                gTitularInterfaceDerivedCompilationUnit);
            #region Namespace For Titular Interface Derived CompilationUnit
            var gTitularInterfaceDerivedNamespace = new GNamespace(gNamespaceName);
            #endregion
            gTitularInterfaceDerivedCompilationUnit.GNamespaces.Add(gTitularInterfaceDerivedNamespace.Philote,
                                                                    gTitularInterfaceDerivedNamespace);
            #region Create Titular Interface Derived Interface
            var gTitularInterfaceDerivedInterface = new GInterface(gTitularInterfaceDerivedName, "public");
            #endregion
            gTitularInterfaceDerivedNamespace.GInterfaces.Add(gTitularInterfaceDerivedInterface.Philote,
                                                              gTitularInterfaceDerivedInterface);
            #endregion
            #endregion
            #region Titular Interface Base CompilationUnit
            #region Pattern Replacements for Interface Base CompilationUnit
            var gInterfaceBaseCompilationUnitPatternReplacement = new GPatternReplacement(
                gDictionary: new Dictionary <Regex, string>()
            {
                { new Regex("CompilationUnitNameReplacementPattern"), "AssemblyUnitNameReplacementPattern" }
            });
            gInterfaceBaseCompilationUnitPatternReplacement.GDictionary.AddRange(gTitularInterfaceAssemblyUnitPatternReplacement.GDictionary);
            #endregion
            #region instantiate the Titular Interface Base CompilationUnit
            var gTitularInterfaceBaseCompilationUnit = new GCompilationUnit(gTitularInterfaceBaseCompilationUnitName,
                                                                            gFileSuffix: ".cs",
                                                                            gRelativePath: subDirectoryForGeneratedFiles,
                                                                            gPatternReplacement: gInterfaceBaseCompilationUnitPatternReplacement);
            #endregion
            gTitularInterfaceAssemblyUnit.GCompilationUnits.Add(gTitularInterfaceBaseCompilationUnit.Philote,
                                                                gTitularInterfaceBaseCompilationUnit);
            #region Namespace For Titular Interface Base CompilationUnit
            var gTitularInterfaceBaseNamespace = new GNamespace(gNamespaceName);
            #endregion
            gTitularInterfaceBaseCompilationUnit.GNamespaces.Add(gTitularInterfaceBaseNamespace.Philote,
                                                                 gTitularInterfaceBaseNamespace);
            #region Create Titular Interface Base Interface
            var gTitularInterfaceBaseInterface = new GInterface(gTitularInterfaceBaseName, "public");
            #endregion
            gTitularInterfaceBaseNamespace.GInterfaces.Add(gTitularInterfaceBaseInterface.Philote,
                                                           gTitularInterfaceBaseInterface);
            #endregion

            /* ************************************************************************************ */
            #region Update the ProjectUnits for both AssemblyUnits
            #region PropertyGroups common to both AssemblyUnits
            new List <IGPropertyGroupInProjectUnit>()
            {
                PropertyGroupInProjectUnitForProjectUnitIsLibrary(),
                PropertyGroupInProjectUnitForPackableOnBuild(),
                PropertyGroupInProjectUnitForLifecycleStage(),
                PropertyGroupInProjectUnitForBuildConfigurations(),
                PropertyGroupInProjectUnitForVersionInfo()
            }.ForEach(gP => {
                gTitularAssemblyUnit.GProjectUnit.GPropertyGroupInProjectUnits.Add(gP.Philote, gP);
                gTitularInterfaceAssemblyUnit.GProjectUnit.GPropertyGroupInProjectUnits.Add(gP.Philote, gP);
            });
            #endregion
            #region ItemGroups common to both AssemblyUnits
            new List <IGItemGroupInProjectUnit>()
            {
                //TBD
            }.ForEach(o => {
                gTitularAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits.Add(o.Philote, o);
                gTitularInterfaceAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits.Add(o.Philote, o);
            });
            #endregion
            #region PropertyGroups only in Titular AssemblyUnit
            #endregion
            #region ItemGroups only in Titular AssemblyUnit
            #endregion
            #region Link the Titular Interfaces AssemblyUnit back to the ProjectUnit in the Titular AssemblyUnit
            var gItemGroupInProjectUint = new GItemGroupInProjectUnit(
                gName: "the Titular Interfaces AssemblyUnit",
                gDescription: "The Interfaces for the Classes specified in this assembly",
                gBody: new GBody(gStatements: new List <string>()
            {
                $"<PackageReference Include=\"{gTitularInterfaceAssemblyUnit.GName}\" />"
            }));
            gTitularAssemblyUnit.GProjectUnit.GItemGroupInProjectUnits.Add(gItemGroupInProjectUint.Philote,
                                                                           gItemGroupInProjectUint);
            #endregion
            #endregion
            GAssemblyGroupBasicConstructorResult mCreateAssemblyGroupResult = new GAssemblyGroupBasicConstructorResult()
            {
                SubDirectoryForGeneratedFiles   = subDirectoryForGeneratedFiles,
                BaseNamespaceName               = baseNamespaceName,
                GAssemblyGroupName              = gAssemblyGroupName,
                GTitularAssemblyUnitName        = gTitularAssemblyUnitName,
                GTitularBaseCompilationUnitName = gTitularBaseCompilationUnitName,
                GAssemblyGroup = gAssemblyGroup,
                gAssemblyGroupPatternReplacement                 = gAssemblyGroupPatternReplacement,
                GTitularAssemblyUnit                             = gTitularAssemblyUnit,
                GTitularAssemblyUnitPatternReplacement           = gTitularAssemblyUnitPatternReplacement,
                GTitularDerivedCompilationUnit                   = gTitularDerivedCompilationUnit,
                GTitularDerivedCompilationUnitPatternReplacement = gTitularDerivedCompilationUnitPatternReplacement,
                GTitularBaseCompilationUnit                      = gTitularBaseCompilationUnit,
                GTitularBaseCompilationUnitPatternReplacement    = gTitularBaseCompilationUnitPatternReplacement,
                GNamespaceDerived       = gNamespaceDerived,
                GNamespaceBase          = gNamespaceBase,
                GClassBase              = gClassBase,
                GClassDerived           = gClassDerived,
                GPrimaryConstructorBase = gPrimaryConstructorBase,
                // If HasInterfaces

                gTitularInterfaceAssemblyUnit           = gTitularInterfaceAssemblyUnit,
                GTitularInterfaceDerivedCompilationUnit = gTitularInterfaceDerivedCompilationUnit,
                GTitularInterfaceBaseCompilationUnit    = gTitularInterfaceBaseCompilationUnit,
                GTitularInterfaceDerivedInterface       = gTitularInterfaceDerivedInterface,
                GTitularInterfaceBaseInterface          = gTitularInterfaceBaseInterface
            };
            return(mCreateAssemblyGroupResult);
        }
Пример #2
0
        void SerializeAndSaveMultipleGGenerateCodeInstances(IPersistence <IInsertResultsAbstract> persistence = default)
        {
            Logger.LogDebug(DebugLocalizer["{0} {1}: Creating JSON from a Signil"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances");

            #region SerializerOptions for all calls to Serialize used by this method
            // Create a new options from the current Serializer options, and change write-indented to true, for all of the LpgDebug statements

            var options = new SerializerOptions()
            {
                WriteIndented = true,
            };
            #endregion

            #region temp

            /*
             #region Philote Serialization
             *    var philoteOfTypeInvokeGenerateCodeSignil = new Philote<GGlobalSettingsSignil>();
             *    var philoteOfTypeInvokeGenerateCodeSignilAsString = Serializer.Serialize(philoteOfTypeInvokeGenerateCodeSignil, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: philoteOfTypeInvokeGenerateCodeSignilAsString = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", philoteOfTypeInvokeGenerateCodeSignilAsString);
             *    ProgressObject!.Report(UiLocalizer["The default constructor of {0} = {1}", "new Philote<GGlobalSettingsSignil>()", philoteOfTypeInvokeGenerateCodeSignilAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    var insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"philoteOfTypeInvokeGenerateCodeSignil", new List<string>() {philoteOfTypeInvokeGenerateCodeSignilAsString}}
             *     });
             #endregion
             #region GComment Serialization (default)
             *    IGComment gComment = new GComment();
             *    var gCommentAsString = Serializer.Serialize(gComment, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gComment = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gCommentAsString);
             *    ProgressObject!.Report(UiLocalizer["The default constructor  {0} = {1}", "new GComment()", gCommentAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gCommentDefault", new List<string>() {gCommentAsString}}
             *     });
             #endregion
             #region GComment Serialization (with data)
             *    gComment = new GComment(new List<string>() { "This is a GComment, line1", "This is a GComment line, line2" });
             *    gCommentAsString = Serializer.Serialize(gComment, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gComment = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gCommentAsString);
             *    ProgressObject!.Report(UiLocalizer["The constructor  {0} = {1}", "new GComment(new List<string>())", gCommentAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gCommentWithData", new List<string>() {gCommentAsString}}
             *     });
             #endregion
             #region GBody Serialization (default)
             *    IGBody gBody = new GBody();
             *    var gBodyAsString = Serializer.Serialize(gBody, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gBody = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gBodyAsString);
             *    ProgressObject!.Report(UiLocalizer["The default constructor  {0} = {1}", "new GBody()", gBodyAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gBodyDefault", new List<string>() {gBodyAsString}}
             *     });
             #endregion
             #region GBody Serialization (with Data)
             *    gBody = new GBody(new List<string>() { "Body Line 1", "BodyLine 2" });
             *    gBodyAsString = Serializer.Serialize(gBody, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gBody = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gBodyAsString);
             *    ProgressObject!.Report(UiLocalizer["The default constructor  {0} = {1}", "new GBody(newList() {{stuff})", gBodyAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gBodyWithData", new List<string>() {gBodyAsString}}
             *     });
             #endregion
             #region GProjectUnit Serialization (default)
             *    IGProjectUnit gProjectUnit = new GProjectUnit();
             *    var gProjectUnitAsString = Serializer.Serialize(gProjectUnit, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gProjectUnit = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gProjectUnitAsString);
             *    ProgressObject!.Report(UiLocalizer["The default constructor  {0} = {1}", "new GProjectUnit()", gProjectUnitAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gProjectUnitDefault", new List<string>() {gProjectUnitAsString}}
             *     });
             #endregion
             #region GProjectUnit Serialization (With Data)
             *    gProjectUnit = new GProjectUnit(
             *      gName: "ATAP.Console.Console01-Mechanical"
             *      , gRelativePath: ".\\"
             *      , gFileSuffix: ".csproj"
             *      , gPropertyGroupInProjectUnits: new Dictionary<IPhilote<IGPropertyGroupInProjectUnit>, IGPropertyGroupInProjectUnit>() { }
             *      , gItemGroupInProjectUnits: new Dictionary<IPhilote<IGItemGroupInProjectUnit>, IGItemGroupInProjectUnit>() { }
             *      , gResourceUnits: new Dictionary<IPhilote<IGResourceUnit>, IGResourceUnit>() { }
             *      , gPatternReplacement: new GPatternReplacement(
             *          gName: "gPatternReplacementProjectUnitForATAP.Console.Console01-Mechanical"
             *          , new Dictionary<System.Text.RegularExpressions.Regex, string>()
             *          , gComment: new GComment(new List<string>() { "Pattern replacement Dictionary for the gProjectUnit having gName = ATAP.Console.Console01-Mechanical" }))
             *      , gComment: new GComment(new List<string>() { "Project (.csproj) file for the Primary executable AssemblyUnit for the mechanically generated version of Console01" })
             *    );
             *    gProjectUnitAsString = Serializer.Serialize(gProjectUnit, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gProjectUnit = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gProjectUnitAsString);
             *    ProgressObject!.Report(UiLocalizer["The constructor {0} = {1}", "new GProjectUnit(stuff)", gProjectUnitAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gProjectUnitWithData", new List<string>() {gProjectUnitAsString}}
             *     });
             #endregion
             #region GAssemblyUnit Serialization (default)
             *    IGAssemblyUnit gAssemblyUnit = new GAssemblyUnit();
             *    var gAssemblyUnitAsString = Serializer.Serialize(gAssemblyUnit, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gAssemblyUnit = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gAssemblyUnitAsString);
             *    ProgressObject!.Report(UiLocalizer["The default constructor  {0} = {1}", "new GAssemblyUnit()", gAssemblyUnitAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gAssemblyUnitDefault", new List<string>() {gAssemblyUnitAsString}}
             *     });
             #endregion
             #region GAssemblyUnit Serialization (With Data)
             *    gAssemblyUnit = new GAssemblyUnit(
             *      gName: "ATAP.Console.Console01-Mechanical"
             *      // ToDo:  Add GDescription to the AssemblyUnit, gDescription: "mechanically generated AssemblyUnit For Console01"
             *      , gRelativePath: ".\\"
             *      //, gProjectUnit: new GProjectUnit()
             *      , gProjectUnit: gProjectUnit
             *      , gPatternReplacement: new GPatternReplacement(
             *          gName: "gPatternReplacementAssemblyUnitForATAP.Console.Console01-Mechanical"
             *          , new Dictionary<System.Text.RegularExpressions.Regex, string>()
             *          , gComment: new GComment(new List<string>() { "Pattern replacement Dictionary for the gAssemblyUnit having gName = ATAP.Console.Console01-Mechanical" }))
             *      , gComment: new GComment(new List<string>() { "Primary executable AssemblyUnit for the mechanically generated version of Console01" })
             *    );
             *    gAssemblyUnitAsString = Serializer.Serialize(gAssemblyUnit, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gAssemblyUnit = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gAssemblyUnitAsString);
             *    ProgressObject!.Report(UiLocalizer["The constructor  {0} = {1}", "new GAssemblyUnit(stuff)", gAssemblyUnitAsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gAssemblyUnitWithData", new List<string>() {gAssemblyUnitAsString}}
             *     });
             #endregion
             *
             *
             #region GAssemblyGroupSignil Serialization (default)
             *    IGAssemblyGroupSignil gAssemblyGroupSignil = new GAssemblyGroupSignil(
             *    );
             *    var gAssemblyGroupSignilAsString = Serializer.Serialize(gAssemblyGroupSignil, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gAssemblyGroupSignil (default) = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gAssemblyGroupSignilAsString);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gAssemblyGroupSignilDefault", new List<string>() {gAssemblyGroupSignilAsString}}
             *     });
             #endregion
             #region GAssemblyGroupSignil Serialization (with data)
             *    gAssemblyGroupSignil = new GAssemblyGroupSignil(
             *      gName: "ATAP.Console.Console01-Mechanical"
             *      , gDescription: "mechanically generated AssemblyGroup For Console01"
             *      , gRelativePath: ".\\"
             *      , gAssemblyUnits: new Dictionary<IPhilote<IGAssemblyUnit>, IGAssemblyUnit>() { }
             *      // , gAssemblyUnits: new Dictionary<IPhilote<IGAssemblyUnit>, IGAssemblyUnit>() { { gAssemblyUnit.Philote, gAssemblyUnit } }
             *      , gPatternReplacement: new GPatternReplacement(
             *          gName: "gPatternReplacementAssemblyGroupForATAP.Console.Console01-Mechanical"
             *          , new Dictionary<System.Text.RegularExpressions.Regex, string>()
             *          , gComment: new GComment(new List<string>() { "Pattern replacement Dictionary for the gAssemblyGroup having gName = ATAP.Console.Console01-Mechanical" }))
             *      , gComment: new GComment(new List<string>() { "Primary executable AssemblyGroup for the mechanically generated version of Console01" })
             *      , hasInterfacesAssembly: false
             *    );
             *    gAssemblyGroupSignilAsString = Serializer.Serialize(gAssemblyGroupSignil, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gAssemblyGroupSignil (with data) = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gAssemblyGroupSignilAsString);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gAssemblyGroupSignilWithData", new List<string>() {gAssemblyGroupSignilAsString}}
             *     });
             #endregion
             *
             *    var _defaultTargetFrameworks = new List<string>() { "netstandard2.1;", "net5.0" };
             *
             #region GSolutionSignil Serialization (default)
             *    var _buildConfigurations = new SortedSet<string>() { "Debug", "ReleaseWithTrace", "Release" };
             *    var _cPUConfigurations = new SortedSet<string>() { "Any CPU" };
             *    var _gDependencyPackages = new Dictionary<IPhilote<IGProjectUnit>, IGProjectUnit>();
             *    var _gDependencyProjects = new Dictionary<IPhilote<IGProjectUnit>, IGProjectUnit>();
             *    var _gProjectUnits = new Dictionary<IPhilote<IGProjectUnit>, IGProjectUnit>();
             *    var _gComment = new GComment(new List<string>() { "ToDo: add SolutionSignil Comments here" });
             *    IGSolutionSignil gSolutionSignilFromCode = new GSolutionSignil(
             *      hasPropsAndTargets: true
             *      , hasEditorConfig: true
             *      , hasArtifacts: true
             *      , hasDevLog: true
             *      , sourceRelativePath: "src"
             *      , testsRelativePath: "tests"
             *      , hasOmniSharpConfiguration: true
             *      , hasVisualStudioCodeWorkspaceConfiguration: true
             *      , buildConfigurations: _buildConfigurations
             *      , cPUConfigurations: _cPUConfigurations
             *      , gDependencyPackages: _gDependencyPackages
             *      , gDependencyProjects: _gDependencyProjects
             *      , gComment: _gComment
             *    );
             *    var gSolutionSignilFromCodeAsSettingsString = Serializer.Serialize(gSolutionSignilFromCode, options);
             *    Logger.LogDebug(DebugLocalizer["{0} {1}: gSolutionSignilFromCode in JSON {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gSolutionSignilFromCodeAsSettingsString);
             *    ProgressObject!.Report(UiLocalizer["The default constructor of {0} = {1}", "new GSolutionSignil(defaultTargetFrameworks)", gSolutionSignilFromCodeAsSettingsString]);
             *    //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
             *    insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             *      {"gSolutionSignilFromCodeAsSettings", new List<string>() {gSolutionSignilFromCodeAsSettingsString}}
             *     });
             #endregion
             */

            #endregion temp
            #region GInvokeGenerateCodeSignil Serialization (default)
            IGInvokeGenerateCodeSignil gInvokeGenerateCodeSignil = new GInvokeGenerateCodeSignil();
            // Many entities are declared not-null
            // var gInvokeGenerateCodeSignilAsString = Serializer.Serialize(gInvokeGenerateCodeSignil, options);
            // Logger.LogDebug(DebugLocalizer["{0} {1}: gInvokeGenerateCodeSignil () = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gInvokeGenerateCodeSignilAsString);
            // //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
            // insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
            //   {"gInvokeGenerateCodeSignilDefault", new List<string>() {gInvokeGenerateCodeSignilAsString}}
            //  });
            #endregion
            #region GInvokeGenerateCodeSignil Serialization (with data)
            var gAssemblyUnit = new GAssemblyUnit(
                gName: "ATAP.Console.Console01-Mechanical"
                // ToDo:  Add GDescription to the AssemblyUnit, gDescription: "mechanically generated AssemblyUnit For Console01"
                , gRelativePath: ".\\"
                , gProjectUnit: new GProjectUnit(
                    gName: "ATAP.Console.Console01-Mechanical"
                    , gRelativePath: ".\\"
                    , gFileSuffix: ".csproj"
                    , gPropertyGroupInProjectUnits: new Dictionary <IPhilote <IGPropertyGroupInProjectUnit>, IGPropertyGroupInProjectUnit>()
            {
            }
                    , gItemGroupInProjectUnits: new Dictionary <IPhilote <IGItemGroupInProjectUnit>, IGItemGroupInProjectUnit>()
            {
            }
                    , gResourceUnits: new Dictionary <IPhilote <IGResourceUnit>, IGResourceUnit>()
            {
            }
                    , gPatternReplacement: new GPatternReplacement(
                        gName: "gPatternReplacementProjectUnitForATAP.Console.Console01-Mechanical"
                        , new Dictionary <System.Text.RegularExpressions.Regex, string>()
                        , gComment: new GComment(new List <string>()
            {
                "Pattern replacement Dictionary for the gProjectUnit having gName = ATAP.Console.Console01-Mechanical"
            }))
                    , gComment: new GComment(new List <string>()
            {
                "Project (.csproj) file for the Primary executable AssemblyUnit for the mechanically generated version of Console01"
            })
                    )
                , gPatternReplacement: new GPatternReplacement(
                    gName: "gPatternReplacementAssemblyUnitForATAP.Console.Console01-Mechanical"
                    , new Dictionary <System.Text.RegularExpressions.Regex, string>()
                    , gComment: new GComment(new List <string>()
            {
                "Pattern replacement Dictionary for the gAssemblyUnit having gName = ATAP.Console.Console01-Mechanical"
            }))
                , gComment: new GComment(new List <string>()
            {
                "Primary executable AssemblyUnit for the mechanically generated version of Console01"
            })
                );
            gInvokeGenerateCodeSignil = new GInvokeGenerateCodeSignil(
                gAssemblyGroupSignil: new GAssemblyGroupSignil(
                    gName: "ATAP.Console.Console01-Mechanical"
                    , gDescription: "mechanically generated AssemblyGroup For Console01"
                    , gRelativePath: ".\\"

                    , gAssemblyUnits: new Dictionary <IPhilote <IGAssemblyUnit>, IGAssemblyUnit>()
            {
                { gAssemblyUnit.Philote, gAssemblyUnit }
            }
                    , gPatternReplacement: new GPatternReplacement(
                        gName: "gPatternReplacementAssemblyGroupForATAP.Console.Console01-Mechanical"
                        , new Dictionary <System.Text.RegularExpressions.Regex, string>()
                        , gComment: new GComment(new List <string>()
            {
                "Pattern replacement Dictionary for the gAssemblyGroup having gName = ATAP.Console.Console01-Mechanical"
            }))
                    , gComment: new GComment(new List <string>()
            {
                "Primary executable AssemblyGroup for the mechanically generated version of Console01"
            })
                    , hasInterfacesAssembly: false
                    )

                //, new GGlobalSettingsSignil()

                , new GSolutionSignil(
                    hasPropsAndTargets: true
                    , hasEditorConfig: true
                    , hasArtifacts: true
                    , hasDevLog: true
                    , hasDocumentation: true
                    , sourceRelativePath: "src"
                    , testsRelativePath: "tests"
                    , hasOmniSharpConfiguration: true
                    , hasVisualStudioCodeWorkspaceConfiguration: true
                    , hasVisualStudioIISApplicationHostConfiguration: false
                    , hasDataBases: false
                    , buildConfigurations: new List <string>()
            {
            }
                    , cPUConfigurations: new SortedSet <string>()
            {
                "Any CPU"
            }
                    , gDependencyPackages: new Dictionary <IPhilote <IGProjectUnit>, IGProjectUnit>()
            {
            }
                    , gDependencyProjects: new Dictionary <IPhilote <IGProjectUnit>, IGProjectUnit>()
            {
            }
                    , gComment: new GComment(new List <string>()
            {
                "The Solution for the mechanically generated version of Console01"
            })
                    , gPatternReplacement: new GPatternReplacement(
                        gName: "gPatternReplacementSolutionForATAP.Console.Console01-Mechanical"
                        , new Dictionary <System.Text.RegularExpressions.Regex, string>()
            {
            }
                        , gComment: new GComment(new List <string>()
            {
                "Pattern replacement Dictionary for the Solution having gName = ATAP.Console.Console01-Mechanical"
            }))
                    )
                , artifactsDirectoryBase: "Artifacts/"
                , artifactsFileRelativePath: "Console02-choice1"
                , artifactsFilePaths: new string[1] {
                "FirstArtifactsFile"
            }
                , temporaryDirectoryBase: "D:/Temp/Console02/"
                , enableProgress: false
                , enablePersistence: false
                , enablePickAndSave: false
                );
            var gInvokeGenerateCodeSignilAsString = Serializer.Serialize(gInvokeGenerateCodeSignil, options);
            Logger.LogDebug(DebugLocalizer["{0} {1}: gInvokeGenerateCodeSignil () = {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gInvokeGenerateCodeSignilAsString);
            //ToDo: wrap in try/catch, handle failure of Persistence InsertFunc
            var insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary <string, IEnumerable <object> >()
            {
                { "gInvokeGenerateCodeSignilWithData", new List <string>()
                  {
                      gInvokeGenerateCodeSignilAsString
                  } }
            });
            #endregion

            /*
             #region GGlobalSettingsSignil to JSON string
             * IGGlobalSettingsSignil gGlobalSettingsSignilFromCode = new GGlobalSettingsSignil(
             * defaultTargetFrameworks: _defaultTargetFrameworks
             * );
             * var gGlobalSettingsSignilFromCodeAsSettingsString = Serializer.Serialize(gGlobalSettingsSignilFromCode, options);
             * //Logger.LogDebug(DebugLocalizer["{0} {1}: SignilFromCode in JSON {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gGlobalSettingsSignilFromCode.Dump());
             * Logger.LogDebug(DebugLocalizer["{0} {1}: gGlobalSettingsSignilFromCode in JSON {2}"], "Console02BackgroundService", "SerializeAndSaveMultipleGGenerateCodeInstances", gGlobalSettingsSignilFromCodeAsSettingsString);
             * ProgressObject!.Report(UiLocalizer["The default constructor of {0} = {1}", "new GGlobalSettingsSignil(defaultTargetFrameworks)", gGlobalSettingsSignilFromCodeAsSettingsString]);
             * // write string to persistence file keyed by gGlobalSettingsSignilFromCodeAsSettings
             * insertResults = PersistenceObject.InsertDictionaryFunc(new Dictionary<string, IEnumerable<object>>() {
             * {"gGlobalSettingsSignilFromCodeAsSettings", new List<string>() {gGlobalSettingsSignilFromCodeAsSettingsString}}
             * });
             * // ToDo: Test for and handle failure of Persistence InsertFunc
             #endregion
             *
             *
             */
        }