public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            Console.WriteLine("Please enter the connection string for the source server.");
            string connectionString = Console.ReadLine();

            Console.WriteLine("Please enter the spatial schema");
            string sschema = Console.ReadLine();

            Console.WriteLine("Please enter the data tables' schema");
            string dtschema = Console.ReadLine();

            Console.WriteLine("Please enter the table name.");
            string tableName = Console.ReadLine();

            Console.WriteLine("Please enter the id column name.");
            string oidColumn = Console.ReadLine();

            Console.WriteLine("Please enter the geometry column name.");
            string geometryColumn = Console.ReadLine();

            Console.WriteLine("Please enter the SRID (e.g EPSG:4326)");
            string srid = Console.ReadLine();

            _sourceProvider = new MsSqlSpatialProvider(geometryServices[srid], connectionString, sschema, dtschema,
                                                       tableName, oidColumn, geometryColumn);
            return(_sourceProvider);
        }
示例#2
0
        public void TestMsSqlSpatialPaged()
        {
            GeometryServices services = new GeometryServices();

            MsSqlSpatialProvider search = new MsSqlSpatialProvider(services.DefaultGeometryFactory,
                                                                   ConfigurationManager.ConnectionStrings["mssqlspatial"
                                                                   ].
                                                                   ConnectionString,
                                                                   "ST",
                                                                   "dbo",
                                                                   "BRoads", "OID", "the_geom")
            {
                DefaultProviderProperties
                    = new ProviderPropertiesExpression(
                          new ProviderPropertyExpression[]
                {
                    new WithNoLockExpression(true),
                    new ForceIndexExpression(true)
                })
            };

            //var binaryExpression =
            //    new CollectionBinaryExpression(new PropertyNameExpression("PostCode"), CollectionOperator.In, new CollectionExpression(new[] { 3, 4, 5, 6 }));


            AttributeBinaryStringExpression binaryExpression = new AttributeBinaryStringExpression("NAME",
                                                                                                   BinaryStringOperator.
                                                                                                   StartsWith, "W");


            ProviderPropertiesExpression providerProps =
                new ProviderPropertiesExpression(
                    new ProviderPropertyExpression[]
            {
                new WithNoLockExpression(true),
                //new OrderByCollectionExpression(new[] {"NAME"}),
                new ForceIndexExpression(true),
                new IndexNamesExpression(new[] { "Index1", "Index2" }),
                new DataPageSizeExpression(10),
                new DataPageNumberExpression(5)
            });


            ProviderQueryExpression prov = new ProviderQueryExpression(providerProps, new AllAttributesExpression(),
                                                                       binaryExpression);

            object obj = search.ExecuteQuery(prov);

            Assert.IsNotNull(obj);
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            Console.WriteLine("Please enter the connection string for the source server.");
            string connectionString = Console.ReadLine();
            Console.WriteLine("Please enter the spatial schema");
            string sschema = Console.ReadLine();
            Console.WriteLine("Please enter the data tables' schema");
            string dtschema = Console.ReadLine();
            Console.WriteLine("Please enter the table name.");
            string tableName = Console.ReadLine();
            Console.WriteLine("Please enter the id column name.");
            string oidColumn = Console.ReadLine();
            Console.WriteLine("Please enter the geometry column name.");
            string geometryColumn = Console.ReadLine();
            Console.WriteLine("Please enter the SRID (e.g EPSG:4326)");
            string srid = Console.ReadLine();

            _sourceProvider = new MsSqlSpatialProvider(geometryServices[srid], connectionString, sschema, dtschema,
                                                       tableName, oidColumn, geometryColumn);
            return _sourceProvider;
        }
示例#4
0
        public void TestMsSqlSpatialPaged()
        {
            GeometryServices services = new GeometryServices();

            MsSqlSpatialProvider search = new MsSqlSpatialProvider(services.DefaultGeometryFactory,
                                                                   ConfigurationManager.ConnectionStrings["mssqlspatial"
                                                                       ].
                                                                       ConnectionString,
                                                                   "ST",
                                                                   "dbo",
                                                                   "BRoads", "OID", "the_geom")
                                              {
                                                  DefaultProviderProperties
                                                      = new ProviderPropertiesExpression(
                                                      new ProviderPropertyExpression[]
                                                          {
                                                              new WithNoLockExpression(true),
                                                              new ForceIndexExpression(true)
                                                          })
                                              };

            //var binaryExpression =
            //    new CollectionBinaryExpression(new PropertyNameExpression("PostCode"), CollectionOperator.In, new CollectionExpression(new[] { 3, 4, 5, 6 }));


            AttributeBinaryStringExpression binaryExpression = new AttributeBinaryStringExpression("NAME",
                                                                                                   BinaryStringOperator.
                                                                                                       StartsWith, "W");


            ProviderPropertiesExpression providerProps =
                new ProviderPropertiesExpression(
                    new ProviderPropertyExpression[]
                        {
                            new WithNoLockExpression(true),
                            //new OrderByCollectionExpression(new[] {"NAME"}),
                            new ForceIndexExpression(true),
                            new IndexNamesExpression(new[] {"Index1", "Index2"}),
                            new DataPageSizeExpression(10),
                            new DataPageNumberExpression(5)
                        });


            ProviderQueryExpression prov = new ProviderQueryExpression(providerProps, new AllAttributesExpression(),
                                                                       binaryExpression);

            object obj = search.ExecuteQuery(prov);

            Assert.IsNotNull(obj);
        }
示例#5
0
 public MsSqlSpatialExpressionTreeToSqlCompiler(MsSqlSpatialProvider provider, Expression query)
     : base(provider, query)
 {
 }