0

Is SqlGeometry.STUnion method thread safe in .Net? MSDN

Musketyr
  • 745
  • 1
  • 16
  • 37

2 Answers2

1

Decompiled body from sql 11.0 assembly using JustDecompile:

    [SqlMethod(IsDeterministic=true, IsPrecise=false)]
    public SqlGeometry STUnion(SqlGeometry other)
    {
        if (this.IsNull || other == null || other.IsNull || this.Srid != other.Srid)
        {
            return SqlGeometry.Null;
        }
        this.ThrowIfInvalid();
        other.ThrowIfInvalid();
        return SqlGeometry.Construct(GLNativeMethods.Union(this.GeoData, other.GeoData), this.Srid);
    }

where SqlGeography.Construct and GLNativeMethods.GeodeticUnion are static methods, while others can't be deadlocked anywhere. None of the methods used is modifying the calling object, so yes - it's thread safe.

Tarec
  • 3,268
  • 4
  • 30
  • 47
0

How can it not be? SqlGeometry seems to be immutable - so the input of 2 immutable classes should be a determined output.

TomTom
  • 61,059
  • 10
  • 88
  • 148
  • I don't understand very well. I have more than 100 thousand items to make union and it is very slow in one cycle. – Musketyr Apr 23 '14 at 10:51