I am trying to create a set of spatial datatypes for SQL Server 2005. Each datatype inherit from the abstract class "Geometry". ie.
public class Point : Geometry
public class Line : Geometry
public class Polygon : Geometry
...and several more.
The reason for using the abstract class Geometry, is that they all share a common set of functions that return a Geometry object. For instance
Geometry Intersection(Geometry g1, Geometry g2)
bool Geometry.Within(Geometry g2)
Polygon Envelope(Geometry g)
etc..
The problem is that when I deploy the assembly to the database, I'm told that the Parameter "Geometry" is unknown. I can't mark it as a Sql-UDT, since this would require it to have a constructor (which abstract classes can't have).
Can this be done, or does anyone have a workaround (fx. using Generics) I'd rather not skip the Geometry class and manually implement all the possible combinations possible for the above functions.
Best regards
Morten Nielsen
http://www.iter.dk

User-Defined Datatypes based on abstract classes
tina m
(The error when the assembly is deployed: Error 1 Cannot find the type 'IGeometry', because it does not exist or you do not have permission.)
If interfaces are not working, is there an other way to get some inheritance Or doesn't it work because it cannot find the other files The interfaces are in the same assembly. Should i put them in there own assembly
Pierre Couzy
jitendra badkas
That forces me to write at least 20-30 times the amount of code than with inheritance. Hmm perhaps I have to rethink the whole implementation.
jaijai
Niels
Andy Wilkinson
Storing the geometry as Well-Known Binary is the way to go, but I think there still are several problems with the lack of inheritance in SQL-CLR, if you want to implement the "Simple Features for SQL" specification in SQL2005.
But I'm all for giving it a try again. It could be pretty cool if we could get it to work. I do have most of the Simple Features in a C# implementation (see http://sharpmap.iter.dk), so it wouldn't be to big a job I guess, if I can get around the inheritance limitations.
wien
GarethJ MSFT
ms_peterk