CodeDom in an IServerObjectExtension

ServerObjectExtensions in 9.2 provide an efficient way to do “fine grain” stuff in AGS.  For example, looping through each feature in a large featureclass and intersecting it with some other geometry to produce a System.Data.Dataset.

I wonder if it would be possible to make a generic ServerObjectExtension that takes source code passed in as an argument, compiles & runs it (via CodeDOM), and returns a Dataset? Or better yet, perhaps it would be possible to take a spatial SQL statement, transform it into C# code, then pass that to the ServerObjectExtension.  Granted, Spatial SQL should now be supported in ArcSDE 9.2  for Oracle, but this approach should work for SQLServer too.

Advertisements

5 comments so far

  1. Morten on

    Why do you want to pass it uncompiled code? Why not just parse a delegate? That will also ensure that the code compiles and furthermore that the expected signature of the extension is correct.

  2. Administrator on

    Hi Morten –

    Not sure how I could pass a delegate across http.

    Let me elaborate a bit further:

    Suppose I have a really extensive ArcSDE instance running in a datacenter, something like Business Analyst Online. I would like to sell services to clients, with costs based on cpu, disk i/o and http data transfer. I do not want to get into the business of writing code to analysis.

    Instead, I would like to provide a service such that 3rd party developers can write code that performs analysis on my geodatabase. Seems like I should be able to write a ServerObjectExtension that leverages CodeDOM to accomplish this. I think this could support a business model that lets developers sell what they do best (programming) and data vendors sell (analyzed) data without writing much code.

    Correct me if I’m wrong, but I don’t think Business Analyst Online supports fine grained access to the geodatabase.

    Regards, Kirk

  3. Bill on

    “…perhaps it would be possible to take a spatial SQL statement, transform it into C# code…”

    You clearly have no concept how SQL works [on any platform]–hint: it is a descriptive language.

  4. Administrator on

    My understanding of SQL is that it is a “non-procedural” language that allows things to be stated more closely as a “natural language”.
    http://www.pcmag.com/encyclopedia_term/0,2542,t=non-procedural+language&i=48052,00.asp

    Perhaps you meant “declarative” instead of “descriptive”?

    It is my understanding that there is a layer that takes a declarative statement and develops an execution plan, prepares it then executes it. Behind the scenes a procedural language is involved. What I am proposing here is a serverobjectextension that accepts a declarative statement, processes it and returns an ADO.NET dataset (or more specifically a FeatureGraphicsLayer).

    Perhaps “transform” is not the correct term … maybe “parse”, or “compile”, anyway, somehow I think lex/yacc could be leveraged for this, this book here mentions use of lex/yacc for sql parsing:
    http://www.amazon.ca/Lex-Yacc-John-R-Levine/dp/1565920007
    Wish I had time to look into this. The only thing I see for doing lex/yacc with .NET is ocamllex and ocamlyacc.

    Interestingly, in googling for lex yacc sql … I find messages about GRASS (wasn’t looking for anything spatial) …
    http://grass.itc.it/pipermail/grass-dev/2005-June/018599.html

    So this is my admittedly vague concept, but a concept nevertheless.

  5. Kirk on

    @Bill
    “…perhaps it would be possible to take a spatial SQL statement, transform it into C# code…”

    Just to follow up, it appears Linq provides something similar to SQL syntax, which it then converts into IL code see:
    http://blogs.msdn.com/mattwar/archive/2007/10/09/linq-building-an-iqueryable-provider-part-viii.aspx

    The question now is how difficult is it take the sample and get it to support spatial operators.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: