/// <summary>
        /// Tries to infer the spatial type kind for the given type.
        /// </summary>
        /// <param name="clrType">The type to check</param>
        /// <param name="spatialTypeKind">The spatial type kind for the type</param>
        /// <returns>true if its a spatial type, otherwise false</returns>
        public static bool TryInferSpatialTypeKind(Type clrType, out SpatialTypeKind? spatialTypeKind)
        {
            ExceptionUtilities.CheckArgumentNotNull(clrType, "clrType");

            if (typeof(Geography).IsAssignableFrom(clrType))
            {
                spatialTypeKind = SpatialTypeKind.Geography;
                return true;
            }
            else if (typeof(Geometry).IsAssignableFrom(clrType))
            {
                spatialTypeKind = SpatialTypeKind.Geometry;
                return true;
            }

            spatialTypeKind = null;
            return false;
        }
Exemple #2
0
        private IDataGenerator <ISpatial> BuildGenerator(string srid, string commonTypeName, SpatialTypeKind kind, bool isUnique, IRandomNumberGenerator random, bool isNullable)
        {
            var availableData = this.BuildTargetedDataSet(srid, commonTypeName, kind).ToList();

            if (isNullable)
            {
                availableData.Add(null);
            }

            return(new FixedSetDataGenerator <ISpatial>(random, !isUnique, availableData));
        }
Exemple #3
0
        private IEnumerable <ISpatial> BuildTargetedDataSet(string srid, string commonTypeName, SpatialTypeKind kind)
        {
            string fileName = string.Format(CultureInfo.InvariantCulture, "{0}_{1}.txt", commonTypeName.ToUpperInvariant(), srid);
            var    data     = ReadTargetedDataSet(fileName);

            return(data.Select(s => this.WellKnownTextFormatter.Parse(kind, s)).Cast <ISpatial>());
        }