Ejemplo n.º 1
0
        /// <summary>
        /// Gets the table name override.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <returns></returns>
        public static ITableNameOverride GetTableNameOverride(string provider)
        {
            if (string.IsNullOrEmpty(provider))
            {
                return(null);
            }

            string name = provider;

            try
            {
                ProviderNameTokens tok    = new ProviderNameTokens(provider);
                string[]           tokens = tok.GetNameTokens();
                name = tokens[0] + "." + tokens[1];
            }
            catch { }

            name = name.ToUpper();

            if (_overrides.ContainsKey(name))
            {
                return(_overrides[name]);
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static TreeNode CreateNode(PhysicalSchemaMapping mapping)
        {
            if (mapping == null)
            {
                throw new ArgumentNullException("mapping");
            }

            //It is okay to return object, since we're feeding this to the property grid anyway.

            using (ProviderNameTokens providerName = new ProviderNameTokens(mapping.Provider))
            {
                string name = string.Join(".", providerName.GetNameTokens().Take(2).ToArray()).ToUpper();
                switch (name)
                {
                case "OSGEO.ODBC":
                    return(CreateOdbcMappingNode(new OSGeo.FDO.Providers.Rdbms.Override.ODBC.OvPhysicalSchemaMapping(mapping, false)));

                case "OSGEO.SHP":
                    return(CreateShpMappingNode(new OSGeo.FDO.Providers.SHP.Override.PhysicalSchemaMapping(mapping, false)));

                case "OSGEO.MYSQL":
                    return(CreateMySqlMappingNode(new OSGeo.FDO.Providers.Rdbms.Override.MySQL.OvPhysicalSchemaMapping(mapping, false)));

                case "OSGEO.SQLSERVERSPATIAL":
                    return(CreateSqlServerMappingNode(new OSGeo.FDO.Providers.Rdbms.Override.SQLServerSpatial.OvPhysicalSchemaMapping(mapping, false)));

                case "OSGEO.WMS":
                    return(CreateWmsMappingNode(new OSGeo.FDO.Providers.WMS.Override.OvPhysicalSchemaMapping(mapping, false)));
                }
            }

            throw new NotSupportedException(ResourceService.GetString("ERR_SCHEMA_MAPPING_UNSUPPORTED_PROVIDER"));
        }
Ejemplo n.º 3
0
        public static TreeNode CreateNode(PhysicalSchemaMapping mapping)
        {
            if (mapping == null)
                throw new ArgumentNullException("mapping");

            //It is okay to return object, since we're feeding this to the property grid anyway.

            using (ProviderNameTokens providerName = new ProviderNameTokens(mapping.Provider))
            {
                string name = string.Join(".", providerName.GetNameTokens().Take(2).ToArray()).ToUpper();
                switch (name)
                {
                    case "OSGEO.ODBC":
                        return CreateOdbcMappingNode(new OSGeo.FDO.Providers.Rdbms.Override.ODBC.OvPhysicalSchemaMapping(mapping, false));
                    case "OSGEO.SHP":
                        return CreateShpMappingNode(new OSGeo.FDO.Providers.SHP.Override.PhysicalSchemaMapping(mapping, false));
                    case "OSGEO.MYSQL":
                        return CreateMySqlMappingNode(new OSGeo.FDO.Providers.Rdbms.Override.MySQL.OvPhysicalSchemaMapping(mapping, false));
                    case "OSGEO.SQLSERVERSPATIAL":
                        return CreateSqlServerMappingNode(new OSGeo.FDO.Providers.Rdbms.Override.SQLServerSpatial.OvPhysicalSchemaMapping(mapping, false));
                    case "OSGEO.WMS":
                        return CreateWmsMappingNode(new OSGeo.FDO.Providers.WMS.Override.OvPhysicalSchemaMapping(mapping, false));    
                }
            }

            throw new NotSupportedException(ResourceService.GetString("ERR_SCHEMA_MAPPING_UNSUPPORTED_PROVIDER"));
        }
        /// <summary>
        /// Gets the table name override.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <returns></returns>
        public static ITableNameOverride GetTableNameOverride(string provider)
        {
            if (string.IsNullOrEmpty(provider))
                return null;

            string name = provider;

            try
            {
                ProviderNameTokens tok = new ProviderNameTokens(provider);
                string[] tokens = tok.GetNameTokens();
                name = tokens[0] + "." + tokens[1];
            }
            catch { }

            name = name.ToUpper();

            if (_overrides.ContainsKey(name))
                return _overrides[name];

            return null;
        }