コード例 #1
0
 public static void RegisterInGeometryColumnsTable(IDbConnection conn, IDbUtility dbUtility, string schema,
                                                   string tableName, string geometryColumn, int coordDimension,
                                                   int srid, string geometryType)
 {
     CreateTableHelper.RegisterInGeometryColumns(conn, dbUtility, schema, tableName, geometryColumn,
                                                 coordDimension, srid, geometryType);
 }
コード例 #2
0
 public static void UnregsiterInGeometryColumnsTable(IDbConnection conn, IDbUtility dbUtility, string schema,
                                                     string tableName)
 {
     if (CreateTableHelper.CheckIfObjectExists(conn, "dbo", "geometry_columns"))
     {
         CreateTableHelper.UnregisterInGeometryColumns(conn, dbUtility, schema, tableName);
     }
 }
コード例 #3
0
        protected SpatialDbProviderBase(IDbUtility dbUtility,
                                        IGeometryFactory geometryFactory,
                                        String connectionString,
                                        String tableSchema,
                                        String tableName,
                                        String oidColumn,
                                        String geometryColumn,
                                        ICoordinateTransformationFactory coordinateTransformationFactory)
        {
            DbUtility                = dbUtility;
            GeometryFactory          = geometryFactory.Clone();
            OriginalSpatialReference = GeometryFactory.SpatialReference;
            OriginalSrid             = GeometryFactory.Srid;

            if (geometryFactory.SpatialReference != null)
            {
                _geometryFactorySridInt = SridMap.DefaultInstance.Process(geometryFactory.SpatialReference, (int?)null);
            }

            if (!String.IsNullOrEmpty(connectionString))
            {
                ConnectionString = connectionString;
            }

            if (!String.IsNullOrEmpty(tableSchema))
            {
                TableSchema = tableSchema;
            }

            if (!String.IsNullOrEmpty(oidColumn))
            {
                OidColumn = oidColumn;
            }

            if (!String.IsNullOrEmpty(geometryColumn))
            {
                GeometryColumn = geometryColumn;
            }

            if (!String.IsNullOrEmpty(tableName))
            {
                Table = tableName;
            }

            CoordinateTransformationFactory = coordinateTransformationFactory;

            ICoordinateSystem cs;
            string            srid;

            ReadSpatialReference(out cs, out srid);

            OriginalSpatialReference         = cs;
            OriginalSrid                     = srid;
            GeometryFactory.SpatialReference = SpatialReference;
            GeometryFactory.Srid             = Srid;
        }
コード例 #4
0
 protected SpatialDbProviderBase(IDbUtility dbUtility,
                                 IGeometryFactory geometryFactory,
                                 String connectionString,
                                 String tableSchema,
                                 String tableName,
                                 String oidColumn,
                                 String geometryColumn)
     : this(dbUtility, geometryFactory, connectionString, tableSchema, tableName, oidColumn, geometryColumn, null
            )
 {
 }
コード例 #5
0
 internal static void DropTable(IDbConnection conn, IDbUtility dbUtility, string schema, string tableName)
 {
     if (CheckIfObjectExists(conn, schema, tableName))
     {
         using (IDbCommand cmd = conn.CreateCommand())
         {
             cmd.CommandText = String.Format("DROP TABLE [{0}].[{1}]", schema, tableName);
             cmd.CommandType = CommandType.Text;
             ExecuteNoQuery(cmd);
         }
     }
 }
コード例 #6
0
ファイル: BasicSetupRepository.cs プロジェクト: lulzzz/Questy
 public BasicSetupRepository(UserManager <ApplicationUser> userManager, IEmailService emailService,
                             IHostingEnvironment environment, IStringConstants stringConstants,
                             ConnectionString connectionString, EmailSettings emailSettings, IDbUtility dbUtility, IFileUtility fileUtility)
 {
     _userManager      = userManager;
     _emailService     = emailService;
     _environment      = environment;
     _stringConstants  = stringConstants;
     _connectionString = connectionString;
     _emailSettings    = emailSettings;
     _dbUtility        = dbUtility;
     _fileUtility      = fileUtility;
 }
コード例 #7
0
        internal static void UnregisterInGeometryColumns(IDbConnection conn, IDbUtility dbUtility, string schema,
                                                         string tableName)
        {
            string sql = string.Format(
                @"DELETE FROM [{0}].[Geometry_Columns] 
            WHERE 
                F_Table_Catalog = @pCatalog 
                AND  F_Table_Schema = @pSchema 
                AND F_Table_Name = @pTable 
                ", schema);

            using (IDbCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;

                cmd.Parameters.Add(dbUtility.CreateParameter("pCatalog", conn.Database, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pSchema", schema, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pTable", tableName, ParameterDirection.Input));
                ExecuteNoQuery(cmd);
            }
        }
コード例 #8
0
        internal static void RegisterInGeometryColumns(IDbConnection conn, IDbUtility dbUtility, string schema,
                                                       string tableName, string geometryColumnName, int coordDimension,
                                                       int srid, string geometryType)
        {
            string sql = string.Format(
                @"IF EXISTS(SELECT * FROM [{0}].[Geometry_Columns] 
            WHERE 
                F_Table_Catalog = @pCatalog 
                AND  F_Table_Schema = @pSchema 
                AND F_Table_Name = @pTable 
                AND F_Geometry_Column = @pGeomColumn)
	BEGIN
		UPDATE [{0}].Geometry_Columns 
			SET 
				Coord_Dimension = @pCoordDimension,
				SRID = @pSrid,
				Geometry_Type = @pGeometryType 
			WHERE 
				F_Table_Catalog = @pCatalog 
				AND F_Table_Schema = @pSchema  
				AND F_Table_Name = @pTable 
				AND F_Geometry_Column = @pGeomColumn 

	END
ELSE
	BEGIN
		INSERT INTO [{0}].[Geometry_Columns](
                        F_Table_Catalog
                        , F_Table_Schema
                        , F_Table_Name
                        , F_Geometry_Column
                        , Coord_Dimension
                        , SRID
                        , Geometry_Type)
		Values(
                @pCatalog
                , @pSchema
                , @pTable
                , @pGeomColumn
                , @pCoordDimension
                , @pSrid
                , @pGeometryType)           
	END"    ,
                schema);

            using (IDbCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;

                cmd.Parameters.Add(dbUtility.CreateParameter("pCatalog", conn.Database, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pSchema", schema, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pTable", tableName, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pGeomColumn", geometryColumnName, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pCoordDimension", coordDimension, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pSrid", srid, ParameterDirection.Input));
                cmd.Parameters.Add(dbUtility.CreateParameter("pGeometryType", geometryType, ParameterDirection.Input));

                ExecuteNoQuery(cmd);
            }
        }
コード例 #9
0
 public static void DropTable(IDbConnection conn, IDbUtility dbUtility, string schema,
                              string tableName)
 {
     UnregsiterInGeometryColumnsTable(conn, dbUtility, schema, tableName);
     CreateTableHelper.DropTable(conn, dbUtility, schema, tableName);
 }