Exemplo n.º 1
0
 /// <summary>
 /// Reads the actual section values
 /// </summary>
 /// <param name="Section"></param>
 private void ReadSectionValues(wwDbResourceProviderSection Section)
 {
     this.ConnectionString               = Section.ConnectionString;
     this.ResourceTableName              = Section.ResourceTableName;
     this.DesignTimeVirtualPath          = Section.DesignTimeVirtualPath;
     this.LocalizationFormWebPath        = Section.LocalizationFormWebPath;
     this.ShowLocalizationControlOptions = Section.ShowLocalizationControlOptions;
     this.ShowControlIcons               = Section.ShowControlIcons;
     this.AddMissingResources            = Section.AddMissingResources;
     this.StronglyTypedGlobalResource    = Section.StronglyTypedGlobalResource;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Reads the wwDbResourceProvider Configuration Section and assigns the values
        /// to the properties of this class
        /// </summary>
        /// <returns></returns>
        public bool ReadConfigurationSection()
        {
            object TSection = WebConfigurationManager.GetWebApplicationSection("wwDbResourceProvider");

            if (TSection == null)
            {
                return(false);
            }

            wwDbResourceProviderSection Section = TSection as wwDbResourceProviderSection;

            this.ReadSectionValues(Section);

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handle design time access to the configuration settings - used for the
        /// wwDbDesignTimeResourceProvider - when loaded we re-read the settings
        /// </summary>
        /// <param name="serviceHost"></param>
        public bool ReadDesignTimeConfiguration(IServiceProvider serviceProvider)
        {
            IWebApplication webApp = serviceProvider.GetService(typeof(IWebApplication)) as IWebApplication;

            // *** Can't get an application instance - can only exit
            if (webApp == null)
            {
                return(false);
            }

            object TSection = webApp.OpenWebConfiguration(true).GetSection("wwDbResourceProvider");

            if (TSection == null)
            {
                return(false);
            }

            wwDbResourceProviderSection Section = TSection as wwDbResourceProviderSection;

            ReadSectionValues(Section);

            // *** If the connection string doesn't contain = then it's
            // *** a ConnectionString key from .config. This is handled in
            // *** in the propertyGet of the resource configration, but it uses
            // *** ConfigurationManager which is not available at design time
            // ***  So we have to duplicate the code here using the WebConfiguration.
            if (!this.ConnectionString.Contains("="))
            {
                try
                {
                    string Conn = webApp.OpenWebConfiguration(true).ConnectionStrings.ConnectionStrings[this.ConnectionString].ConnectionString;
                    this.ConnectionString = Conn;
                }
                catch { }
            }

            return(true);
        }