Esempio n. 1
0
 private System.Configuration.Configuration OpenConfiguration()
 {
     System.Configuration.Configuration configuration = !string.IsNullOrEmpty(this._ConfigurationPath) ? ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap()
     {
         ExeConfigFilename = this._ConfigurationPath
     }, ConfigurationUserLevel.None) : ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     if (!(configuration.GetSection("WCFGenerator") is GeneratorSection))
     {
         GeneratorSection generatorSection = new GeneratorSection();
         configuration.Sections.Add("WCFGenerator", (ConfigurationSection)generatorSection);
     }
     return(configuration);
 }
Esempio n. 2
0
        public void SaveForAllServices(IService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service), "Parent service is expected, but null found.");
            }
            System.Configuration.Configuration configuration = this.OpenConfiguration();
            GeneratorSection section = configuration.GetSection("WCFGenerator") as GeneratorSection;

            section.ForAllRootService = new ServiceSettingsElement();
            this.ExportServicesToConfig(section.ForAllRootService, (ServiceSettingsElement)null, new List <IService>((IEnumerable <IService>) new IService[1]
            {
                service
            }));
            configuration.Save();
        }
Esempio n. 3
0
        public void ApplyForAllToServices(IService service, bool isPreview)
        {
            GeneratorSection section = this.OpenConfiguration().GetSection("WCFGenerator") as GeneratorSection;

            if (!isPreview)
            {
                this.ExposeChildServices(new List <IService>((IEnumerable <IService>) new IService[1]
                {
                    service
                }));
                this.ImportServicesForAllFromConfig(section.ForAllRootService, service);
                this.ApplySpecificMethods(service);
            }
            else
            {
                this.ImportServicesFromConfig(section.ForAllRootService, service);
            }
        }
Esempio n. 4
0
        public GeneratorSettings(string path)
        {
            this._ConfigurationPath = path;
            GeneratorSection section = this.OpenConfiguration().GetSection("WCFGenerator") as GeneratorSection;

            this._IsGenerateAll         = section.ServicesSettings.IsGenerateAll;
            this._IsGenerateSilverlight = section.ServicesSettings.IsGenerateSilverlight;
            this._Address                          = section.ServicesSettings.Address;
            this._ProcessTxnGUID                   = section.ServicesSettings.ProcessTxnGUID;
            this._LogXmlDocument                   = section.ServicesSettings.LogXmlDocument;
            this._UseSSL                           = section.ServicesSettings.UseSSL;
            this._LogPath                          = section.ServicesSettings.LogPath;
            this._LogNaming                        = section.ServicesSettings.LogNaming;
            this._ClientOutputConfigPath           = section.GeneratedAssemblySettings.ClientOutputConfigPath;
            this._ClientOutputDirectory            = section.GeneratedAssemblySettings.ClientOutputDirectory;
            this._ClientSilverlightOutputDirectory = section.GeneratedAssemblySettings.ClientSilverlightOutputDirectory;
            this._ServerOutputDirectory            = section.GeneratedAssemblySettings.ServerOutputDirectory;
            this._DatabaseConnectionString         = section.ConnectionSettings.DatabaseConnectionString;
            this._DefaultServerConnectionString    = section.ConnectionSettings.DefaultServerConnectionString;
            this._IsGetFromRegistry                = section.ConnectionSettings.IsGetFromRegistry;
            this._ConnectionStrings                = section.ConnectionSettings.ConnectionStrings;
        }
Esempio n. 5
0
        public void SaveAs(string path)
        {
            if (this._ConfigurationPath == path)
            {
                path = (string)null;
            }
            System.Configuration.Configuration configuration = this.OpenConfiguration();
            if (!string.IsNullOrEmpty(path))
            {
                this._ConfigurationPath = path;
            }
            GeneratorSection section = configuration.GetSection("WCFGenerator") as GeneratorSection;

            section.ServicesSettings.IsGenerateAll         = this._IsGenerateAll;
            section.ServicesSettings.IsGenerateSilverlight = this._IsGenerateSilverlight;
            section.ServicesSettings.Address        = this._Address;
            section.ServicesSettings.LogNaming      = this._LogNaming;
            section.ServicesSettings.LogPath        = this._LogPath;
            section.ServicesSettings.LogXmlDocument = this._LogXmlDocument;
            section.ServicesSettings.UseSSL         = this._UseSSL;
            section.ServicesSettings.ProcessTxnGUID = this._ProcessTxnGUID;
            section.GeneratedAssemblySettings.ClientOutputConfigPath           = this._ClientOutputConfigPath;
            section.GeneratedAssemblySettings.ClientOutputDirectory            = this._ClientOutputDirectory;
            section.GeneratedAssemblySettings.ClientSilverlightOutputDirectory = this._ClientSilverlightOutputDirectory;
            section.GeneratedAssemblySettings.ServerOutputDirectory            = this._ServerOutputDirectory;
            section.ConnectionSettings.DatabaseConnectionString      = this._DatabaseConnectionString;
            section.ConnectionSettings.DefaultServerConnectionString = this._DefaultServerConnectionString;
            section.ConnectionSettings.IsGetFromRegistry             = this._IsGetFromRegistry;
            section.ConnectionSettings.ConnectionStrings             = this._ConnectionStrings;
            if (string.IsNullOrEmpty(path))
            {
                configuration.Save();
            }
            else
            {
                configuration.SaveAs(this._ConfigurationPath);
            }
        }