[mapguide-commits] r7466 - in sandbox/jng/querydef: Common/MdfModel Common/MdfParser Common/PlatformBase Common/PlatformBase/Exception Common/PlatformBase/Services Common/Schema Server Server/src/Services/Feature Server/src/UnitTesting UnitTest/TestData/FeatureService/SQLite

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Apr 30 13:43:25 PDT 2013


Author: jng
Date: 2013-04-30 13:43:25 -0700 (Tue, 30 Apr 2013)
New Revision: 7466

Added:
   sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.cpp
   sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.h
   sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.cpp
   sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.h
   sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.cpp
   sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.h
   sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.cpp
   sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.h
Modified:
   sandbox/jng/querydef/Common/MdfModel/GeometryInfo.cpp
   sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.cpp
   sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.h
   sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp
   sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj
   sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters
   sandbox/jng/querydef/Common/MdfParser/SAX2Parser.cpp
   sandbox/jng/querydef/Common/PlatformBase/PlatformBase.h
   sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj
   sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj.filters
   sandbox/jng/querydef/Common/PlatformBase/PlatformBaseBuild.cpp
   sandbox/jng/querydef/Common/PlatformBase/Services/PlatformBaseClassId.h
   sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd
   sandbox/jng/querydef/Server/Server_VS2010.sln
   sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.cpp
   sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj
   sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters
   sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp
   sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp
   sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.h
   sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateCount.QueryDefinition
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateSpatialExtents.QueryDefinition
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicAllElements.QueryDefinition
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithExplicitPropertyList.QueryDefinition
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithFilter.QueryDefinition
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLBasic.QueryDefinition
   sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLWhereJoin.QueryDefinition
Log:
This submission includes the following changes:

 - Fix defects in QueryDefinition parsing
 - Fix unititialized members in MdfModel::GeometryInfo
 - Add a new MgInvalidQueryDefinitionException class to cover all errors relating to bad query definitions
 - Update ComputedProperty in QueryDefinition-2.6.0.xsd to better make re-use of existing parsing code
 - Implement the ExecuteQueryDefinition API on the server
   - Add a new MgServerExecuteQueryDefinition class to handle all QueryDefinition related concerns
   - Add a new MgServerQueryDefinitionReader class that provides a MgFeatureService adapter to the internal query reader result, which could be a MgFeatureReader, a MgDataReader, or a MgSqlDataReader
   - Add a new ExecuteQueryDefinition method to MgServerFeatureUtil. This method does the grunt of this work.
 - Fix bad asserts our new unit tests and correct some of the query definition test data

With this submission, our entire Query Definition test suite passes.

Modified: sandbox/jng/querydef/Common/MdfModel/GeometryInfo.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfModel/GeometryInfo.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfModel/GeometryInfo.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -21,7 +21,9 @@
 using namespace MDFMODEL_NAMESPACE;
 
 GeometryInfo::GeometryInfo(const MdfString& strGeometry, const int& iGeomTypes)
-    : m_geometry(strGeometry), m_geometryTypes(iGeomTypes)
+    : m_geometry(strGeometry), m_geometryTypes(iGeomTypes), m_lowerLeftCoordinate(NULL), m_upperRightCoordinate(NULL),
+    m_scDescription(L""), m_scName(L""), m_csName(L""), m_csWkt(L""), m_extentType(SpatialContextExtentType::Dynamic),
+    m_xyTolerance(0.0), m_zTolerance(0.0)
 { }
 
 GeometryInfo::~GeometryInfo()

Modified: sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/IOAggregateQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -16,7 +16,7 @@
 //
 #include "stdafx.h"
 #include "IOAggregateQueryDefinition.h"
-#include "IONameStringPair.h"
+#include "IOComputedPropertyCollection.h"
 #include "IOGeometryInfo.h"
 #include "IOQueryParameter.h"
 #include "Common/IOStringObjectCollection.h"
@@ -65,8 +65,7 @@
 
     case eGeometryInfo:
         {
-            GeometryInfo* geom = this->m_query->GetGeometryInfo();
-            IOGeometryInfo* IO = new IOGeometryInfo(geom, this->m_version);
+            IOGeometryInfo* IO = new IOGeometryInfo(this->m_query, this->m_version);
             handlerStack->push(IO);
             IO->StartElement(name, handlerStack);
         }
@@ -101,7 +100,7 @@
 
     case eComputedProperties:
         {
-            IONameStringPair* IO = new IONameStringPair(this->m_query, this->m_version);
+            IOComputedPropertyCollection* IO = new IOComputedPropertyCollection(this->m_query, this->m_version);
             handlerStack->push(IO);
             IO->StartElement(name, handlerStack);
         }

Added: sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.cpp	                        (rev 0)
+++ sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,82 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+#include "stdafx.h"
+#include "IOComputedPropertyCollection.h"
+#include "IONameStringPair.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+CREATE_ELEMENT_MAP;
+ELEM_MAP_ENTRY(1, ComputedProperties);
+ELEM_MAP_ENTRY(2, ComputedProperty);
+
+IOComputedPropertyCollection::IOComputedPropertyCollection(Version& version) : SAX2ElementHandler(version)
+{
+    m_query = NULL;
+}
+
+IOComputedPropertyCollection::IOComputedPropertyCollection(BaseSelectQueryDefinition* query, Version& version) : SAX2ElementHandler(version)
+{
+    m_query = query;
+}
+
+IOComputedPropertyCollection::~IOComputedPropertyCollection()
+{
+}
+
+void IOComputedPropertyCollection::StartElement(const wchar_t* name, HandlerStack* handlerStack)
+{
+    this->m_currElemName = name;
+    this->m_currElemId = _ElementIdFromName(name);
+
+    switch (this->m_currElemId)
+    {
+    case eComputedProperties:
+        this->m_startElemName = name;
+        break;
+
+    case eComputedProperty:
+        {
+            IONameStringPair* IO = new IONameStringPair(this->m_query, this->m_version);
+            handlerStack->push(IO);
+            IO->StartElement(name, handlerStack);
+        }
+        break;
+    }
+}
+
+void IOComputedPropertyCollection::ElementChars(const wchar_t* ch)
+{
+}
+
+void IOComputedPropertyCollection::EndElement(const wchar_t* name, HandlerStack* handlerStack)
+{
+    if (this->m_startElemName == name)
+    {
+        this->m_query->SetUnknownXml(this->m_unknownXml);
+
+        this->m_query = NULL;
+        this->m_startElemName = L"";
+        handlerStack->pop();
+        delete this;
+    }
+}
+
+void IOComputedPropertyCollection::Write(MdfStream& fd, BaseSelectQueryDefinition* query, Version* version, MgTab& tab)
+{ }
\ No newline at end of file

Added: sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.h
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.h	                        (rev 0)
+++ sandbox/jng/querydef/Common/MdfParser/IOComputedPropertyCollection.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,48 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+#ifndef _IOCOMPUTEDPROPERTYCOLLECTION_H
+#define _IOCOMPUTEDPROPERTYCOLLECTION_H
+
+#include "SAX2ElementHandler.h"
+#include "BaseSelectQueryDefinition.h"
+#include "Version.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOComputedPropertyCollection : public SAX2ElementHandler
+{
+    public:
+        IOComputedPropertyCollection(Version& version);
+        IOComputedPropertyCollection(BaseSelectQueryDefinition* query, Version& version);
+        virtual ~IOComputedPropertyCollection();
+
+        virtual void StartElement(const wchar_t* name, HandlerStack* handlerStack);
+        virtual void ElementChars(const wchar_t* ch);
+        virtual void EndElement(const wchar_t* name, HandlerStack* handlerStack);
+
+        static void Write(MdfStream& fd, BaseSelectQueryDefinition* query, Version* version, MgTab& tab);
+
+    private:
+        BaseSelectQueryDefinition* m_query;
+};
+
+END_NAMESPACE_MDFPARSER
+
+#endif  //_IOCOMPUTEDPROPERTYCOLLECTION_H
\ No newline at end of file

Modified: sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/IOFeatureQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -16,7 +16,7 @@
 //
 #include "stdafx.h"
 #include "IOFeatureQueryDefinition.h"
-#include "IONameStringPair.h"
+#include "IOComputedPropertyCollection.h"
 #include "IOGeometryInfo.h"
 #include "IOQueryParameter.h"
 #include "Common/IOStringObjectCollection.h"
@@ -65,8 +65,7 @@
 
     case eGeometryInfo:
         {
-            GeometryInfo* geom = this->m_query->GetGeometryInfo();
-            IOGeometryInfo* IO = new IOGeometryInfo(geom, this->m_version);
+            IOGeometryInfo* IO = new IOGeometryInfo(this->m_query, this->m_version);
             handlerStack->push(IO);
             IO->StartElement(name, handlerStack);
         }
@@ -101,7 +100,7 @@
 
     case eComputedProperties:
         {
-            IONameStringPair* IO = new IONameStringPair(this->m_query, this->m_version);
+            IOComputedPropertyCollection* IO = new IOComputedPropertyCollection(this->m_query, this->m_version);
             handlerStack->push(IO);
             IO->StartElement(name, handlerStack);
         }

Modified: sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -30,12 +30,14 @@
 
 IOGeometryInfo::IOGeometryInfo(Version& version) : SAX2ElementHandler(version)
 {
+    this->m_query = NULL;
     this->m_geom = NULL;
 }
 
-IOGeometryInfo::IOGeometryInfo(GeometryInfo* geom, Version& version) : SAX2ElementHandler(version)
+IOGeometryInfo::IOGeometryInfo(QueryDefinition* query, Version& version) : SAX2ElementHandler(version)
 {
-    this->m_geom = geom;
+    this->m_query = query;
+    this->m_geom = NULL;
 }
 
 IOGeometryInfo::~IOGeometryInfo() 
@@ -50,6 +52,10 @@
     {
     case eGeometryInfo:
         this->m_startElemName = name;
+        if (this->m_geom == NULL)
+        {
+            this->m_geom = new GeometryInfo(L"", 7); //7 - all types
+        }
         break;
 
     case eSpatialContext:
@@ -82,7 +88,17 @@
 
 void IOGeometryInfo::EndElement(const wchar_t* name, HandlerStack* handlerStack)
 {
+    if (this->m_startElemName == name)
+    {
+        this->m_geom->SetUnknownXml(this->m_unknownXml);
 
+        this->m_query->AdoptGeometryInfo(this->m_geom);
+        this->m_query = NULL;
+        this->m_geom = NULL;
+        this->m_startElemName = L"";
+        handlerStack->pop();
+        delete this;
+    }
 }
 
 void IOGeometryInfo::Write(MdfStream& fd, GeometryInfo* geom, Version* version, MgTab& tab)

Modified: sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.h
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.h	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/IOGeometryInfo.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -18,7 +18,7 @@
 #define _IOGEOMETRYINFO_H
 
 #include "SAX2ElementHandler.h"
-#include "GeometryInfo.h"
+#include "QueryDefinition.h"
 #include "Version.h"
 
 using namespace XERCES_CPP_NAMESPACE;
@@ -30,7 +30,7 @@
 {
     public:
         IOGeometryInfo(Version& version);
-        IOGeometryInfo(GeometryInfo* geom, Version& version);
+        IOGeometryInfo(QueryDefinition* query, Version& version);
         virtual ~IOGeometryInfo();
 
         virtual void StartElement(const wchar_t* name, HandlerStack* handlerStack);
@@ -40,6 +40,7 @@
         static void Write(MdfStream& fd, GeometryInfo* geom, Version* version, MgTab& tab);
 
     private:
+        QueryDefinition* m_query;
         GeometryInfo* m_geom;
 };
 

Modified: sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/IOSQLQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -59,8 +59,7 @@
 
     case eGeometryInfo:
         {
-            GeometryInfo* geom = this->m_query->GetGeometryInfo();
-            IOGeometryInfo* IO = new IOGeometryInfo(geom, this->m_version);
+            IOGeometryInfo* IO = new IOGeometryInfo(this->m_query, this->m_version);
             handlerStack->push(IO);
             IO->StartElement(name, handlerStack);
         }

Modified: sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj	2013-04-30 20:43:25 UTC (rev 7466)
@@ -196,6 +196,7 @@
     <ClCompile Include="Common\IOStringObjectCollection.cpp" />
     <ClCompile Include="Common\IOVector3D.cpp" />
     <ClCompile Include="IOAggregateQueryDefinition.cpp" />
+    <ClCompile Include="IOComputedPropertyCollection.cpp" />
     <ClCompile Include="IOFeatureQueryDefinition.cpp" />
     <ClCompile Include="IOGeometryInfo.cpp" />
     <ClCompile Include="IOQueryParameter.cpp" />
@@ -317,6 +318,7 @@
     <ClInclude Include="Common\IOStringObjectCollection.h" />
     <ClInclude Include="Common\IOVector3D.h" />
     <ClInclude Include="IOAggregateQueryDefinition.h" />
+    <ClInclude Include="IOComputedPropertyCollection.h" />
     <ClInclude Include="IOFeatureQueryDefinition.h" />
     <ClInclude Include="IOGeometryInfo.h" />
     <ClInclude Include="IOQueryParameter.h" />

Modified: sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/MdfParser.vcxproj.filters	2013-04-30 20:43:25 UTC (rev 7466)
@@ -202,6 +202,9 @@
     <ClCompile Include="IOQueryParameterCollection.cpp">
       <Filter>QueryDefinition</Filter>
     </ClCompile>
+    <ClCompile Include="IOComputedPropertyCollection.cpp">
+      <Filter>QueryDefinition</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Common\IOColor.h">
@@ -391,6 +394,9 @@
     <ClInclude Include="IOQueryParameterCollection.h">
       <Filter>QueryDefinition</Filter>
     </ClInclude>
+    <ClInclude Include="IOComputedPropertyCollection.h">
+      <Filter>QueryDefinition</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="MdfParser.rc" />

Modified: sandbox/jng/querydef/Common/MdfParser/SAX2Parser.cpp
===================================================================
--- sandbox/jng/querydef/Common/MdfParser/SAX2Parser.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/MdfParser/SAX2Parser.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -75,6 +75,9 @@
     delete m_vLayer;
     delete m_dLayer;
     delete m_gLayer;
+    delete m_aggregateQuery;
+    delete m_featureQuery;
+    delete m_sqlQuery;
     delete m_sSymbol;
     delete m_cSymbol;
     delete m_printLayout;
@@ -91,6 +94,9 @@
     m_vLayer = NULL;
     m_dLayer = NULL;
     m_gLayer = NULL;
+    m_featureQuery = NULL;
+    m_aggregateQuery = NULL;
+    m_sqlQuery = NULL;
     m_sSymbol = NULL;
     m_cSymbol = NULL;
     m_printLayout = NULL;

Added: sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.cpp
===================================================================
--- sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.cpp	                        (rev 0)
+++ sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,40 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "PlatformBase.h"
+
+IMPLEMENT_EXCEPTION_DEFAULTS(MgInvalidQueryDefinitionException, MgApplicationException)
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Construct a MgInvalidQueryDefinitionException object.
+///
+MgInvalidQueryDefinitionException::MgInvalidQueryDefinitionException(CREFSTRING methodName,
+    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
+    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
+    MgApplicationException(methodName, lineNumber, fileName,
+        whatArguments, whyMessageId, whyArguments)
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Destruct the object.
+///
+MgInvalidQueryDefinitionException::~MgInvalidQueryDefinitionException() throw()
+{
+}

Added: sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.h
===================================================================
--- sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.h	                        (rev 0)
+++ sandbox/jng/querydef/Common/PlatformBase/Exception/InvalidQueryDefinitionException.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,71 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef MG_INVALID_QUERY_DEFINITION_EXCEPTION_H_
+#define MG_INVALID_QUERY_DEFINITION_EXCEPTION_H_
+
+/// \ingroup Exceptions_Module
+
+#include "PlatformBase.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Thrown when a map definition resource is invalid.
+///
+class MG_PLATFORMBASE_API MgInvalidQueryDefinitionException : public MgApplicationException
+{
+    DECLARE_CLASSNAME(MgInvalidQueryDefinitionException)
+
+EXTERNAL_API:
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Construct a MgInvalidQueryDefinitionException object.
+    ///
+    /// \param methodName
+    /// Name of the method where the exception occurred.
+    /// \param lineNumber
+    /// Line number where the exception occurred.
+    /// \param fileName
+    /// File name where the exception occurred.
+    /// \param whatArguments
+    /// Collection of arguments used to format the message that describes what the exception is.
+    /// \param whyMessageId
+    /// ID of the message that describes why the exception occurs.
+    /// \param whyArguments
+    /// Collection of arguments used to format the message that describes why the exception occurs.
+    ///
+    MgInvalidQueryDefinitionException(CREFSTRING methodName, INT32 lineNumber,
+        CREFSTRING fileName, MgStringCollection* whatArguments,
+        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Destructor for a MgInvalidQueryDefinitionException object.
+    ///
+    virtual ~MgInvalidQueryDefinitionException() throw();
+
+INTERNAL_API:
+
+    DECLARE_EXCEPTION_DEFAULTS(MgInvalidQueryDefinitionException)
+
+CLASS_ID:
+
+    static const INT32 m_cls_id = PlatformBase_Exception_MgInvalidQueryDefinitionException;
+};
+
+#endif

Modified: sandbox/jng/querydef/Common/PlatformBase/PlatformBase.h
===================================================================
--- sandbox/jng/querydef/Common/PlatformBase/PlatformBase.h	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/PlatformBase/PlatformBase.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -62,6 +62,7 @@
 #include "Exception/FeatureServiceException.h"
 #include "Exception/InvalidLayerDefinitionException.h"
 #include "Exception/InvalidMapDefinitionException.h"
+#include "Exception/InvalidQueryDefinitionException.h"
 #include "Exception/InvalidWatermarkDefinitionException.h"
 #include "Exception/InvalidRepositoryNameException.h"
 #include "Exception/InvalidRepositoryTypeException.h"

Modified: sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj
===================================================================
--- sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj	2013-04-30 20:43:25 UTC (rev 7466)
@@ -340,6 +340,12 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="Exception\InvalidQueryDefinitionException.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="Exception\InvalidRepositoryNameException.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -874,6 +880,7 @@
     <ClInclude Include="Exception\FeatureServiceException.h" />
     <ClInclude Include="Exception\InvalidLayerDefinitionException.h" />
     <ClInclude Include="Exception\InvalidMapDefinitionException.h" />
+    <ClInclude Include="Exception\InvalidQueryDefinitionException.h" />
     <ClInclude Include="Exception\InvalidRepositoryNameException.h" />
     <ClInclude Include="Exception\InvalidRepositoryTypeException.h" />
     <ClInclude Include="Exception\InvalidResourceDataNameException.h" />

Modified: sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj.filters
===================================================================
--- sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj.filters	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/PlatformBase/PlatformBase.vcxproj.filters	2013-04-30 20:43:25 UTC (rev 7466)
@@ -352,6 +352,9 @@
       <Filter>MapLayer</Filter>
     </ClCompile>
     <ClCompile Include="PlatformBaseBuild.cpp" />
+    <ClCompile Include="Exception\InvalidQueryDefinitionException.cpp">
+      <Filter>Exception</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Data\BlobProperty.h">
@@ -736,6 +739,9 @@
       <Filter>MapLayer</Filter>
     </ClInclude>
     <ClInclude Include="PlatformBase.h" />
+    <ClInclude Include="Exception\InvalidQueryDefinitionException.h">
+      <Filter>Exception</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="PlatformBase.rc" />

Modified: sandbox/jng/querydef/Common/PlatformBase/PlatformBaseBuild.cpp
===================================================================
--- sandbox/jng/querydef/Common/PlatformBase/PlatformBaseBuild.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/PlatformBase/PlatformBaseBuild.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -42,6 +42,7 @@
 #include "Exception/FeatureServiceException.cpp"
 #include "Exception/InvalidMapDefinitionException.cpp"
 #include "Exception/InvalidLayerDefinitionException.cpp"
+#include "Exception/InvalidQueryDefinitionException.cpp"
 #include "Exception/InvalidWatermarkDefinitionException.cpp"
 #include "Exception/InvalidRepositoryNameException.cpp"
 #include "Exception/InvalidRepositoryTypeException.cpp"

Modified: sandbox/jng/querydef/Common/PlatformBase/Services/PlatformBaseClassId.h
===================================================================
--- sandbox/jng/querydef/Common/PlatformBase/Services/PlatformBaseClassId.h	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/PlatformBase/Services/PlatformBaseClassId.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -79,7 +79,8 @@
 #define PlatformBase_Exception_MgServiceNotAvailableException               PLATFORMBASE_EXCEPTION_ID+21
 #define PlatformBase_Exception_MgServiceNotSupportedException               PLATFORMBASE_EXCEPTION_ID+22
 #define PlatformBase_Exception_MgUserNotFoundException                      PLATFORMBASE_EXCEPTION_ID+23
-#define PlatformBase_Exception_MgInvalidWatermarkDefinitionException            PLATFORMBASE_EXCEPTION_ID+24
+#define PlatformBase_Exception_MgInvalidWatermarkDefinitionException        PLATFORMBASE_EXCEPTION_ID+24
+#define PlatformBase_Exception_MgInvalidQueryDefinitionException            PLATFORMBASE_EXCEPTION_ID+25
 
 // MapLayer API
 #define PlatformBase_MapLayer_MapBase                               PLATFORMBASE_MAPLAYER_ID+0

Modified: sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd
===================================================================
--- sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Common/Schema/QueryDefinition-2.6.0.xsd	2013-04-30 20:43:25 UTC (rev 7466)
@@ -188,7 +188,7 @@
           <xs:documentation>Specifies the alias for this computed property</xs:documentation>
         </xs:annotation>
       </xs:element>
-      <xs:element name="Expression" type="xs:string">
+      <xs:element name="Value" type="xs:string">
         <xs:annotation>
           <xs:documentation>Specifies the FDO expression for this computed property</xs:documentation>
         </xs:annotation>

Modified: sandbox/jng/querydef/Server/Server_VS2010.sln
===================================================================
--- sandbox/jng/querydef/Server/Server_VS2010.sln	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/Server_VS2010.sln	2013-04-30 20:43:25 UTC (rev 7466)
@@ -1,5 +1,5 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Express 2012 for Windows Desktop
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerCore", "src\Core\ServerCore.vcxproj", "{FDF553DE-0D30-4456-8A84-5009C9EAAED2}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foundation", "..\Common\Foundation\Foundation.vcxproj", "{A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425}"
@@ -277,7 +277,9 @@
 		{42491401-B624-440D-91D7-1F2633EFB4E3}.Release|x64.ActiveCfg = Release|x64
 		{42491401-B624-440D-91D7-1F2633EFB4E3}.Release|x64.Build.0 = Release|x64
 		{DD0284A0-1ECE-4387-AED3-E9BF5EE74FF8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DD0284A0-1ECE-4387-AED3-E9BF5EE74FF8}.Debug|Win32.Build.0 = Debug|Win32
 		{DD0284A0-1ECE-4387-AED3-E9BF5EE74FF8}.Debug|x64.ActiveCfg = Debug|x64
+		{DD0284A0-1ECE-4387-AED3-E9BF5EE74FF8}.Debug|x64.Build.0 = Debug|x64
 		{DD0284A0-1ECE-4387-AED3-E9BF5EE74FF8}.Release|Win32.ActiveCfg = Release|Win32
 		{DD0284A0-1ECE-4387-AED3-E9BF5EE74FF8}.Release|Win32.Build.0 = Release|Win32
 		{DD0284A0-1ECE-4387-AED3-E9BF5EE74FF8}.Release|x64.ActiveCfg = Release|x64

Added: sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.cpp	                        (rev 0)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,211 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "QueryDefinition.h"
+#include "FeatureQueryDefinition.h"
+#include "AggregateQueryDefinition.h"
+#include "SQLQueryDefinition.h"
+#include "SAX2Parser.h"
+#include "ServerFeatureServiceDefs.h"
+#include "ServerExecuteQueryDefinition.h"
+
+MgServerExecuteQueryDefinition::MgServerExecuteQueryDefinition(MgFeatureService* featureService) 
+{ 
+    m_featureService = SAFE_ADDREF(featureService);
+}
+
+MgServerExecuteQueryDefinition::~MgServerExecuteQueryDefinition() 
+{ 
+    m_featureService = NULL;
+}
+
+MdfModel::QueryDefinition* MgServerExecuteQueryDefinition::GetQueryDefinition(MgResourceIdentifier* queryId)
+{
+    Ptr<MgResourceService> resourceService = GetResourceService();
+    CHECKNULL(resourceService, L"MgServerExecuteQueryDefinition.GetQueryDefinition");
+    
+    Ptr<MgByteReader> content = resourceService->GetResourceContent(queryId);
+    Ptr<MgByteSink> sink = new MgByteSink(content);
+    Ptr<MgByte> bytes = sink->ToBuffer();
+
+    assert(bytes->GetLength() > 0);
+
+    MdfParser::SAX2Parser parser;
+    parser.ParseString((const char*)bytes->Bytes(), bytes->GetLength());
+
+    if (!parser.GetSucceeded())
+    {
+        STRING errorMsg = parser.GetErrorMessage();
+        MgStringCollection arguments;
+        arguments.Add(errorMsg);
+        throw new MgInvalidQueryDefinitionException(L"MgServerExecuteQueryDefinition.GetQueryDefinition", __LINE__, __WFILE__, &arguments, L"", NULL);
+    }
+
+    MdfModel::QueryDefinition* qdef = parser.DetachQueryDefinition();
+    assert(qdef != NULL);
+
+    return qdef;
+}
+
+MgFeatureReader* MgServerExecuteQueryDefinition::ExecuteQueryDefinition(MgResourceIdentifier* queryId)
+{
+    MdfModel::QueryDefinition* qdef = GetQueryDefinition(queryId);
+
+    //Farm it off to MgServerFeatureUtil
+    return MgServerFeatureUtil::ExecuteQueryDefinition(m_featureService, qdef, NULL);
+}
+
+MgFeatureReader* MgServerExecuteQueryDefinition::ExecuteQueryDefinition(MgResourceIdentifier* queryId, MgPropertyCollection* queryParameters)
+{
+    MdfModel::QueryDefinition* qdef = GetQueryDefinition(queryId);
+
+    //Farm it off to MgServerFeatureUtil
+    return MgServerFeatureUtil::ExecuteQueryDefinition(m_featureService, qdef, queryParameters);
+}
+
+MgSpatialContextReader* MgServerExecuteQueryDefinition::GetSpatialContexts(MgResourceIdentifier* queryId)
+{
+    return GetSpatialContexts(queryId, true);
+}
+
+MgSpatialContextReader* MgServerExecuteQueryDefinition::GetSpatialContexts(MgResourceIdentifier* queryId, bool bActiveOnly)
+{
+    MdfModel::QueryDefinition* qdef = GetQueryDefinition(queryId);
+    MdfModel::GeometryInfo* geomInfo = qdef->GetGeometryInfo();
+
+    Ptr<MgSpatialContextReader> scReader = new MgSpatialContextReader();
+
+    if (geomInfo != NULL) 
+    {
+        Ptr<MgSpatialContextData> scData = new MgSpatialContextData();
+        scData->SetActiveStatus(true);
+        scData->SetName(geomInfo->GetSpatialContextName());
+        scData->SetCoordinateSystem(geomInfo->GetCoordinateSystemName());
+        scData->SetCoordinateSystemWkt(geomInfo->GetCoordinateSystemWkt());
+        scData->SetDescription(geomInfo->GetSpatialContextDescription());
+
+        //Extent
+        MdfModel::SpatialContextCoordinate* ll = geomInfo->GetSpatialContextLowerLeftCoordinate();
+        MdfModel::SpatialContextCoordinate* ur = geomInfo->GetSpatialContextUpperRightCoordinate();
+        if (ll && ur)
+        {
+            MgAgfReaderWriter agfRw;
+            Ptr<MgCoordinateXY> c1 = new MgCoordinateXY(ll->GetX(), ll->GetY());
+            Ptr<MgCoordinateXY> c2 = new MgCoordinateXY(ur->GetX(), ll->GetY());
+            Ptr<MgCoordinateXY> c3 = new MgCoordinateXY(ur->GetX(), ur->GetY());
+            Ptr<MgCoordinateXY> c4 = new MgCoordinateXY(ll->GetX(), ur->GetY());
+            Ptr<MgCoordinateXY> c5 = new MgCoordinateXY(ll->GetX(), ll->GetY());
+
+            Ptr<MgCoordinateCollection> cc = new MgCoordinateCollection();
+            cc->Add(c1);
+            cc->Add(c2);
+            cc->Add(c3);
+            cc->Add(c4);
+            cc->Add(c5);
+
+            Ptr<MgLinearRing> outer = new MgLinearRing(cc);
+            Ptr<MgPolygon> poly = new MgPolygon(outer, NULL);
+
+            Ptr<MgByteReader> agf = agfRw.Write(poly);
+            Ptr<MgByteSink> agfSink = new MgByteSink(agf);
+            Ptr<MgByte> agfBytes = agfSink->ToBuffer();
+
+            scData->SetExtent(agfBytes);
+        }
+
+        scData->SetExtentType((geomInfo->GetSpatialContextExtentType() == GeometryInfo::Dynamic) ? MgSpatialContextExtentType::scDynamic : MgSpatialContextExtentType::scStatic);
+        scData->SetXYTolerance(geomInfo->GetSpatialContextXYTolerance());
+        scData->SetZTolerance(geomInfo->GetSpatialContextZTolerance());
+        
+        scReader->AddSpatialData(scData);
+    }
+
+    return scReader.Detach();
+}
+
+MgFeatureSchemaCollection* MgServerExecuteQueryDefinition::DescribeSchema(MgResourceIdentifier* queryId, CREFSTRING schemaName, MgStringCollection* classNames, bool /* serialize */)
+{
+    //This is simple, there will only ever be one schema (Default) and one class (Query), so reject
+    //any invalid schema/class names
+    if (!schemaName.empty() && L"Default" != schemaName) //NOXLATE
+    {
+        //throw   
+    }
+    if (NULL != classNames)
+    {
+        if (classNames->GetCount() > 1)
+        {
+            //throw
+        }
+        else if (classNames->GetCount() == 1)
+        {
+            if (classNames->GetItem(0) != L"Query") //NOXLATE
+            {
+                //throw
+            }
+        }
+    }
+
+    Ptr<MgFeatureSchemaCollection> schemas = new MgFeatureSchemaCollection();
+    MdfModel::QueryDefinition* qdef = GetQueryDefinition(queryId);
+    Ptr<MgFeatureReader> fr = MgServerFeatureUtil::ExecuteQueryDefinition(m_featureService, qdef, NULL);
+    Ptr<MgFeatureSchema> schema = new MgFeatureSchema(L"Default", L"System-generated schema");
+    Ptr<MgClassDefinitionCollection> classes = schema->GetClasses();
+    Ptr<MgClassDefinition> clsDef = fr->GetClassDefinition();
+    classes->Add(clsDef);
+    schemas->Add(schema);
+    //We're done with the reader, we only wanted the class definition.
+    fr->Close();
+    return schemas.Detach();
+}
+
+STRING MgServerExecuteQueryDefinition::DescribeSchemaAsXml(MgResourceIdentifier* queryId, CREFSTRING schemaName, MgStringCollection* classNames)
+{
+    Ptr<MgFeatureSchemaCollection> schemas = DescribeSchema(queryId, schemaName, classNames);
+    return m_featureService->SchemaToXml(schemas);
+}
+
+MgStringCollection* MgServerExecuteQueryDefinition::GetSchemas(MgResourceIdentifier* queryId)
+{
+    Ptr<MgStringCollection> names = new MgStringCollection();
+    names->Add(L"Default"); //NOXLATE
+    return names.Detach();
+}
+
+MgStringCollection* MgServerExecuteQueryDefinition::GetClasses(MgResourceIdentifier* queryId, CREFSTRING schemaName)
+{
+    Ptr<MgStringCollection> names = new MgStringCollection();
+    names->Add(L"Query"); //NOXLATE
+    return names.Detach();
+}
+
+MgClassDefinition* MgServerExecuteQueryDefinition::GetClassDefinition(MgResourceIdentifier* queryId, CREFSTRING schemaName, CREFSTRING className, bool serialize)
+{
+    throw new MgNotImplementedException(L"MgServerExecuteQueryDefinition.GetClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+MgResourceService* MgServerExecuteQueryDefinition::GetResourceService()
+{
+    MgServiceManager* serviceMan = MgServiceManager::GetInstance();
+    if (NULL != serviceMan)
+    {
+        MgResourceService* resourceService = dynamic_cast<MgResourceService*>(
+        serviceMan->RequestService(MgServiceType::ResourceService));
+        return resourceService;
+    }
+    return NULL;
+}
\ No newline at end of file

Added: sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.h
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.h	                        (rev 0)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerExecuteQueryDefinition.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,44 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef _MG_SERVER_EXECUTE_QUERY_DEFINITION_H_
+#define _MG_SERVER_EXECUTE_QUERY_DEFINITION_H_
+
+class MgServerExecuteQueryDefinition
+{
+public:
+    MgServerExecuteQueryDefinition(MgFeatureService* featSvc);
+    ~MgServerExecuteQueryDefinition();
+
+    MgFeatureReader* ExecuteQueryDefinition(MgResourceIdentifier* queryId);
+    MgFeatureReader* ExecuteQueryDefinition(MgResourceIdentifier* queryId, MgPropertyCollection* queryParameters);
+    MgSpatialContextReader* GetSpatialContexts(MgResourceIdentifier* queryId);
+    MgSpatialContextReader* GetSpatialContexts(MgResourceIdentifier* queryId, bool bActiveOnly);
+    MgFeatureSchemaCollection* DescribeSchema(MgResourceIdentifier* queryId, CREFSTRING schemaName, MgStringCollection* classNames, bool serialize = true);
+    STRING DescribeSchemaAsXml(MgResourceIdentifier* queryId, CREFSTRING schemaName, MgStringCollection* classNames);
+    MgStringCollection* GetSchemas(MgResourceIdentifier* queryId);
+    MgStringCollection* GetClasses(MgResourceIdentifier* queryId, CREFSTRING schemaName);
+    MgClassDefinition*  GetClassDefinition(MgResourceIdentifier* queryId, CREFSTRING schemaName, CREFSTRING className, bool serialize = true);
+    
+private:
+
+    MdfModel::QueryDefinition* GetQueryDefinition(MgResourceIdentifier* queryId);
+    MgResourceService* GetResourceService();
+    Ptr<MgFeatureService> m_featureService;
+};
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -39,6 +39,7 @@
 #include "ServerFdoFeatureReader.h"
 #include "ServerEnumerateDataStores.h"
 #include "ServerGetSchemaMapping.h"
+#include "ServerExecuteQueryDefinition.h"
 #include "FilterUtil.h"
 #include "LongTransactionManager.h"
 #include "TransformCache.h"
@@ -337,8 +338,16 @@
     logDetail.AddObject(L"ClassNames", classNames);
     logDetail.Create();
 
-    MgServerDescribeSchema msds;
-    schemas = msds.DescribeSchema(resource, schemaName, classNames);
+    if (resource->GetResourceType() == MgResourceType::QueryDefinition)
+    {
+        MgServerExecuteQueryDefinition exec(this);
+        schemas = exec.DescribeSchema(resource, schemaName, classNames);
+    }
+    else
+    {
+        MgServerDescribeSchema msds;
+        schemas = msds.DescribeSchema(resource, schemaName, classNames);
+    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW_WITH_FEATURE_SOURCE(L"MgServerFeatureService.DescribeSchema", resource);
 
@@ -382,8 +391,16 @@
     logDetail.AddObject(L"ClassNames", classNames);
     logDetail.Create();
 
-    MgServerDescribeSchema msds;
-    schemaXml = msds.DescribeSchemaAsXml(resource, schemaName, classNames);
+    if (resource->GetResourceType() == MgResourceType::QueryDefinition)
+    {
+        MgServerExecuteQueryDefinition exec(this);
+        schemaXml = exec.DescribeSchemaAsXml(resource, schemaName, classNames);
+    }
+    else
+    {
+        MgServerDescribeSchema msds;
+        schemaXml = msds.DescribeSchemaAsXml(resource, schemaName, classNames);
+    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW_WITH_FEATURE_SOURCE(L"MgServerFeatureService.DescribeSchemaAsXml", resource);
 
@@ -542,11 +559,8 @@
 ///
 MgFeatureReader* MgServerFeatureService::ExecuteQueryDefinition(MgResourceIdentifier* resource)
 {
-    throw new MgNotImplementedException(
-        L"MgServerFeatureService::ExecuteQueryDefinition",
-        __LINE__, __WFILE__, NULL, L"", NULL);
-
-    return NULL; // to make some compiler happy
+    MgServerExecuteQueryDefinition exec(this);
+    return exec.ExecuteQueryDefinition(resource);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -581,11 +595,8 @@
 ///
 MgFeatureReader* MgServerFeatureService::ExecuteQueryDefinition(MgResourceIdentifier* resource, MgPropertyCollection* parameters)
 {
-    throw new MgNotImplementedException(
-        L"MgServerFeatureService::ExecuteQueryDefinition",
-        __LINE__, __WFILE__, NULL, L"", NULL);
-
-    return NULL; // to make some compiler happy
+    MgServerExecuteQueryDefinition exec(this);
+    return exec.ExecuteQueryDefinition(resource, parameters);
 }
 
 //////////////////////////////////////////////////////////////////
@@ -1043,8 +1054,16 @@
     logDetail.AddBool(L"ActiveOnly", bActiveOnly);
     logDetail.Create();
 
-    MgServerGetSpatialContexts msgsc;
-    reader = msgsc.GetSpatialContexts(resource);
+    if (resource->GetResourceType() == MgResourceType::QueryDefinition)
+    {
+        MgServerExecuteQueryDefinition exec(this);
+        reader = exec.GetSpatialContexts(resource);
+    }
+    else
+    {
+        MgServerGetSpatialContexts msgsc;
+        reader = msgsc.GetSpatialContexts(resource);
+    }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW_WITH_FEATURE_SOURCE(L"MgServerFeatureService.GetSpatialContexts", resource)
 
@@ -1511,20 +1530,38 @@
 //////////////////////////////////////////////////////////////////
 MgStringCollection* MgServerFeatureService::GetSchemas( MgResourceIdentifier* resource )
 {
+    CHECKARGUMENTNULL(resource, L"MgServerFeatureService.GetSchemas");
     MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::GetSchemas()");
 
-    MgServerDescribeSchema msds;
-    return msds.GetSchemas(resource);
+    if (resource->GetResourceType() == MgResourceType::QueryDefinition)
+    {
+        MgServerExecuteQueryDefinition exec(this);
+        return exec.GetSchemas(resource);
+    }
+    else
+    {
+        MgServerDescribeSchema msds;
+        return msds.GetSchemas(resource);
+    }
 }
 
 
 //////////////////////////////////////////////////////////////////
 MgStringCollection* MgServerFeatureService::GetClasses( MgResourceIdentifier* resource, CREFSTRING schemaName )
 {
+    CHECKARGUMENTNULL(resource, L"MgServerFeatureService.GetClasses");
     MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::GetClasses()");
 
-    MgServerDescribeSchema msds;
-    return msds.GetClasses(resource, schemaName);
+    if (resource->GetResourceType() == MgResourceType::QueryDefinition)
+    {
+        MgServerExecuteQueryDefinition exec(this);
+        return exec.GetClasses(resource, schemaName);
+    }
+    else
+    {
+        MgServerDescribeSchema msds;
+        return msds.GetClasses(resource, schemaName);
+    }
 }
 
 
@@ -1533,10 +1570,19 @@
                                                               CREFSTRING schemaName,
                                                               CREFSTRING className)
 {
+    CHECKARGUMENTNULL(resource, L"MgServerFeatureService.GetClasses");
     MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::GetClassDefinition()");
 
-    MgServerDescribeSchema msds;
-    return msds.GetClassDefinition(resource, schemaName, className, true);
+    if (resource->GetResourceType() == MgResourceType::QueryDefinition)
+    {
+        MgServerExecuteQueryDefinition exec(this);
+        return exec.GetClassDefinition(resource, schemaName, className, true);
+    }
+    else
+    {
+        MgServerDescribeSchema msds;
+        return msds.GetClassDefinition(resource, schemaName, className, true);
+    }
 }
 
 
@@ -1546,10 +1592,19 @@
                                                               CREFSTRING className,
                                                               bool serialize)
 {
+    CHECKARGUMENTNULL(resource, L"MgServerFeatureService.GetClasses");
     MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::GetClassDefinition()");
 
-    MgServerDescribeSchema msds;
-    return msds.GetClassDefinition(resource, schemaName, className, serialize);
+    if (resource->GetResourceType() == MgResourceType::QueryDefinition)
+    {
+        MgServerExecuteQueryDefinition exec(this);
+        return exec.GetClassDefinition(resource, schemaName, className, serialize);
+    }
+    else
+    {
+        MgServerDescribeSchema msds;
+        return msds.GetClassDefinition(resource, schemaName, className, serialize);
+    }
 }
 
 

Modified: sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj	2013-04-30 20:43:25 UTC (rev 7466)
@@ -639,6 +639,12 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="ServerExecuteQueryDefinition.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="ServerFdoFeatureReader.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -744,6 +750,12 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="ServerQueryDefinitionReader.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="ServerSelectFeatures.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -873,6 +885,7 @@
     <ClInclude Include="ServerDeleteCommand.h" />
     <ClInclude Include="ServerDescribeSchema.h" />
     <ClInclude Include="ServerEnumerateDataStores.h" />
+    <ClInclude Include="ServerExecuteQueryDefinition.h" />
     <ClInclude Include="ServerFdoFeatureReader.h" />
     <ClInclude Include="ServerFeatureConnection.h" />
     <ClInclude Include="ServerFeatureDllExport.h" />
@@ -897,6 +910,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </CustomBuildStep>
     <ClInclude Include="ServerInsertCommand.h" />
+    <ClInclude Include="ServerQueryDefinitionReader.h" />
     <ClInclude Include="ServerSelectFeatures.h" />
     <ClInclude Include="ServerSqlCommand.h" />
     <ClInclude Include="ServerSqlDataReader.h" />

Modified: sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureService.vcxproj.filters	2013-04-30 20:43:25 UTC (rev 7466)
@@ -191,6 +191,8 @@
     <ClCompile Include="OpExecuteQueryDefinition.cpp">
       <Filter>Ops</Filter>
     </ClCompile>
+    <ClCompile Include="ServerExecuteQueryDefinition.cpp" />
+    <ClCompile Include="ServerQueryDefinitionReader.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="FeatureOperation.h">
@@ -391,6 +393,8 @@
     <ClInclude Include="OpExecuteQueryDefinition.h">
       <Filter>Ops</Filter>
     </ClInclude>
+    <ClInclude Include="ServerExecuteQueryDefinition.h" />
+    <ClInclude Include="ServerQueryDefinitionReader.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="ServerFeatureService.rc" />

Modified: sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureServiceBuild.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -46,11 +46,13 @@
 #include "ServerGetFeatureProviders.cpp"
 #include "ServerGetProviderCapabilities.cpp"
 #include "ServerSelectFeatures.cpp"
+#include "ServerExecuteQueryDefinition.cpp"
 #include "OpCloseFeatureReader.cpp"
 #include "OpGetFeatures.cpp"
 #include "ServerFeatureReader.cpp"
 #include "ServerFdoFeatureReader.cpp"
 #include "ServerFeatureReaderPool.cpp"
+#include "ServerQueryDefinitionReader.cpp"
 #include "OpGetLongTransactions.cpp"
 #include "ServerGetConnectionPropertyValues.cpp"
 #include "ServerGetLongTransactions.cpp"

Modified: sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -3624,3 +3624,250 @@
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureUtil.ExtractIdentifiers")
     return ret.Detach();
 }
+
+MgFeatureReader* MgServerFeatureUtil::ExecuteQueryDefinition(MgFeatureService* featureService, MdfModel::QueryDefinition* qdef, MgPropertyCollection* queryParameters)
+{
+    CHECKARGUMENTNULL(featureService, L"MgServerFeatureUtil.ExecuteQueryDefinition");
+    CHECKARGUMENTNULL(qdef, L"MgServerFeatureUtil.ExecuteQueryDefinition");
+
+    Ptr<MgFeatureReader> reader;
+    MG_FEATURE_SERVICE_TRY()
+
+    MdfModel::FeatureQueryDefinition* fq = dynamic_cast<MdfModel::FeatureQueryDefinition*>(qdef);
+    MdfModel::AggregateQueryDefinition* aq = dynamic_cast<MdfModel::AggregateQueryDefinition*>(qdef);
+    MdfModel::SQLQueryDefinition* sq = dynamic_cast<MdfModel::SQLQueryDefinition*>(qdef);
+    MdfModel::GeometryInfo* geomInfo = qdef->GetGeometryInfo();
+
+    Ptr<MgReader> innerReader;
+    Ptr<MgClassDefinition> classDef;
+    const MdfModel::MdfString& resIdStr = qdef->GetResourceID();
+    if (resIdStr.empty())
+    {
+        throw new MgInvalidQueryDefinitionException(L"MgServerFeatureUtil.ExecuteQueryDefinition", __LINE__, __WFILE__, NULL, L"MgQueryDefinitionEmptyResourceId", NULL);
+    }
+
+    Ptr<MgResourceIdentifier> fsId = new MgResourceIdentifier(resIdStr);
+    if (fq || aq)
+    {
+        Ptr<MgFeatureQueryOptions> queryOpts;
+
+        MdfModel::BaseSelectQueryDefinition* bsq = NULL;
+        if (fq) 
+        {
+            queryOpts = new MgFeatureQueryOptions();
+            bsq = fq;
+        }
+        else if (aq)
+        {
+            //Apply aggregate-specific options
+            Ptr<MgFeatureAggregateOptions> aggOpts = new MgFeatureAggregateOptions();
+
+            MdfModel::StringObjectCollection* groupBy = aq->GetGrouping();
+            const MdfString& groupByFilter = aq->GetGroupFilter();
+            if (groupBy->GetCount() > 0 && !groupByFilter.empty())
+            {
+                Ptr<MgStringCollection> props = new MgStringCollection();
+                for (INT32 i = 0; i < groupBy->GetCount(); i++)
+                {
+                    MdfModel::StringObject* str = groupBy->GetAt(i);
+                    props->Add(str->GetString());
+                }
+
+                aggOpts->SetGroupingFilter(props, groupByFilter);
+            }
+            queryOpts = aggOpts;
+            bsq = aq;
+        }
+
+        //Now apply what's common to both
+
+        //Filter (spatial filter is assumed to be already in here)
+        if (!bsq->GetFilter().empty())
+            queryOpts->SetFilter(bsq->GetFilter());
+
+        //Properties
+        MdfModel::StringObjectCollection* clsProps = bsq->GetProperties();
+        if (clsProps->GetCount() > 0) 
+        {
+            for (INT32 i = 0; i < clsProps->GetCount(); i++)
+            {
+                queryOpts->AddFeatureProperty(clsProps->GetAt(i)->GetString());
+            }
+        }
+
+        //Computed
+        MdfModel::NameStringPairCollection* computed = bsq->GetComputedProperties();
+        if (computed->GetCount() > 0)
+        {
+            for (INT32 i = 0; i < computed->GetCount(); i++)
+            {
+                queryOpts->AddComputedProperty(computed->GetAt(i)->GetName(),
+                                               computed->GetAt(i)->GetValue());
+            }
+        }
+
+        //Order By
+        MdfModel::StringObjectCollection* orderByProps = bsq->GetOrdering();
+        if (orderByProps->GetCount() > 0)
+        {
+            Ptr<MgStringCollection> orderProps = new MgStringCollection();
+            for (INT32 i = 0; i < orderByProps->GetCount(); i++)
+            {
+                orderProps->Add(orderByProps->GetAt(i)->GetString());
+            }
+            queryOpts->SetOrderingFilter(orderProps, (bsq->GetOrderingOption() == BaseSelectQueryDefinition::Ascending) ? MgOrderingOption::Ascending : MgOrderingOption::Descending);
+        }
+
+        if (fq)
+        {
+            innerReader = featureService->SelectFeatures(fsId, bsq->GetFeatureClass(), queryOpts);
+            classDef = ((MgFeatureReader*)innerReader.p)->GetClassDefinition();
+        }
+        else if (aq)
+        {
+            innerReader = featureService->SelectAggregate(fsId, bsq->GetFeatureClass(), ((MgFeatureAggregateOptions*)queryOpts.p));
+            //We construct a class definition based on the inner reader's structure, then apply any geometry
+            //identity overrides from the query definition
+            classDef = new MgClassDefinition();
+            Ptr<MgPropertyDefinitionCollection> clsIdProps = classDef->GetIdentityProperties();
+            Ptr<MgPropertyDefinitionCollection> clsProps = classDef->GetProperties();
+            for (INT32 i = 0; i < innerReader->GetPropertyCount(); i++)
+            {
+                INT32 ptype = innerReader->GetPropertyType(i);
+                STRING pName = innerReader->GetPropertyName(i);
+                if (ptype == MgPropertyType::Geometry)
+                {
+                    Ptr<MgGeometricPropertyDefinition> geomProp = new MgGeometricPropertyDefinition(pName);
+                    geomProp->SetGeometryTypes(MgFeatureGeometricType::Point | MgFeatureGeometricType::Curve | MgFeatureGeometricType::Surface);
+                    //Don't know spatial context association. Will be set below if there is one
+                    clsProps->Add(geomProp);
+                }
+                else if (ptype != MgPropertyType::Feature && 
+                         ptype != MgPropertyType::Null &&
+                         ptype != MgPropertyType::Raster) //We can skip rasters because this is a *vector* feature query after all
+                {
+                    Ptr<MgDataPropertyDefinition> dataProp = new MgDataPropertyDefinition(pName);
+                    dataProp->SetDataType(ptype);
+                    //Flub some defaults in case someone actually *tries* to use this class definition as a basis for a new
+                    //Feature Source
+                    dataProp->SetNullable(true);
+                    if (ptype != MgPropertyType::String)
+                        dataProp->SetLength(512);
+
+                    //Don't know if identity. Will be set below if query definition specifies it
+                    clsProps->Add(dataProp);
+                }
+            }
+        }
+    }
+    else if (sq)
+    {
+        innerReader = featureService->ExecuteSqlQuery(fsId, sq->GetSQL());
+        //We construct a class definition based on the inner reader's structure, then apply any geometry
+        //identity overrides from the query definition
+        classDef = new MgClassDefinition();
+        Ptr<MgPropertyDefinitionCollection> clsIdProps = classDef->GetIdentityProperties();
+        Ptr<MgPropertyDefinitionCollection> clsProps = classDef->GetProperties();
+        for (INT32 i = 0; i < innerReader->GetPropertyCount(); i++)
+        {
+            INT32 ptype = innerReader->GetPropertyType(i);
+            STRING pName = innerReader->GetPropertyName(i);
+            if (ptype == MgPropertyType::Geometry)
+            {
+                Ptr<MgGeometricPropertyDefinition> geomProp = new MgGeometricPropertyDefinition(pName);
+                geomProp->SetGeometryTypes(MgFeatureGeometricType::Point | MgFeatureGeometricType::Curve | MgFeatureGeometricType::Surface);
+                //Don't know spatial context association. Will be set below if there is one
+                clsProps->Add(geomProp);
+            }
+            else if (ptype != MgPropertyType::Feature && 
+                        ptype != MgPropertyType::Null &&
+                        ptype != MgPropertyType::Raster) //We can skip rasters because this is a *vector* feature query after all
+            {
+                Ptr<MgDataPropertyDefinition> dataProp = new MgDataPropertyDefinition(pName);
+                dataProp->SetDataType(ptype);
+                //Flub some defaults in case someone actually *tries* to use this class definition as a basis for a new
+                //Feature Source
+                dataProp->SetNullable(true);
+                if (ptype != MgPropertyType::String)
+                    dataProp->SetLength(512);
+
+                //Don't know if identity. Will be set below if query definition specifies it
+                clsProps->Add(dataProp);
+            }
+        }
+    }
+
+    //If the Query Definition resolves to a known sub-type, processing will give us an inner MgReader and a modified
+    //MgClassDefinition. We can only return a wrapped MgServerQueryDefinitionReader if these two things exist at this
+    //point
+
+    if (innerReader.p && classDef.p)
+    {
+        //Make any necessary modifications to the designated geometry an identity properties
+        Ptr<MgPropertyDefinitionCollection> clsIdProps = classDef->GetIdentityProperties();
+        Ptr<MgPropertyDefinitionCollection> clsProps = classDef->GetProperties();
+        MdfModel::StringObjectCollection* idProps = qdef->GetIdentityProperties();
+        if (idProps->GetCount() > 0)
+        {
+            //Clear existing identity props, we're overriding based on what's declared in the query
+            clsIdProps->Clear();
+            for (INT32 i = 0; i < idProps->GetCount(); i++)
+            {
+                INT32 pidx = clsProps->IndexOf(idProps->GetAt(i)->GetString());
+                if (pidx < 0)
+                {
+                    throw new MgInvalidQueryDefinitionException(L"MgServerFeatureUtil.ExecuteQueryDefinition", __LINE__, __WFILE__, NULL, L"MgIdentityPropertyNotFound", NULL);
+                }
+                Ptr<MgPropertyDefinition> idProp = clsProps->GetItem(pidx);
+                if (idProp->GetPropertyType() != MgFeaturePropertyType::DataProperty)
+                {
+                    throw new MgInvalidQueryDefinitionException(L"MgServerFeatureUtil.ExecuteQueryDefinition", __LINE__, __WFILE__, NULL, L"MgInvalidIdentityProperty", NULL);
+                }
+                //Force non-nullability just in case
+                Ptr<MgDataPropertyDefinition> dataProp = (MgDataPropertyDefinition*)(SAFE_ADDREF(idProp.p));
+                dataProp->SetNullable(false);
+                clsIdProps->Add(idProp);
+            }
+        }
+        if (NULL != geomInfo)
+        {
+            //The geometry property we want to override must exist
+            INT32 pidx = clsProps->IndexOf(geomInfo->GetGeometry());
+            if (pidx < 0)
+            {
+                throw new MgInvalidQueryDefinitionException(L"MgServerFeatureUtil.ExecuteQueryDefinition", __LINE__, __WFILE__, NULL, L"MgGeometryPropertyNotFound", NULL);
+            }
+            Ptr<MgPropertyDefinition> prop = clsProps->GetItem(pidx);
+            //Must be geometric too
+            if (prop->GetPropertyType() != MgFeaturePropertyType::GeometricProperty)
+            {
+                throw new MgInvalidQueryDefinitionException(L"MgServerFeatureUtil.ExecuteQueryDefinition", __LINE__, __WFILE__, NULL, L"MgGeometryPropertyNotFound", NULL);
+            }
+            Ptr<MgGeometricPropertyDefinition> geomProp = (MgGeometricPropertyDefinition*)(SAFE_ADDREF(prop.p));
+            //Override the bits we want to override
+            geomProp->SetSpatialContextAssociation(geomInfo->GetSpatialContextName());
+            geomProp->SetGeometryTypes(geomInfo->GetGeometryTypes());
+            classDef->SetDefaultGeometryPropertyName(geomInfo->GetGeometry());
+        }
+        else
+        {
+            //Scrub out designated geometry
+            classDef->SetDefaultGeometryPropertyName(L"");
+            //Scrub out spatial context associations as well
+            for (INT32 i = 0; i < clsProps->GetCount(); i++)
+            {
+                Ptr<MgPropertyDefinition> prop = clsProps->GetItem(i);
+                if (prop->GetPropertyType() == MgFeaturePropertyType::GeometricProperty)
+                {
+                    ((MgGeometricPropertyDefinition*)prop.p)->SetSpatialContextAssociation(L"");
+                }
+            }
+        }
+
+        classDef->SetName(L"Query"); //NOXLATE
+        reader = new MgServerQueryDefinitionReader(innerReader, classDef);
+    }
+
+    MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureUtil.ExecuteQueryDefinition")
+    return reader.Detach();
+}
\ No newline at end of file

Modified: sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.h
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.h	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerFeatureUtil.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -45,6 +45,11 @@
 
 class MgReader;
 
+namespace MdfModel
+{
+    class QueryDefinition;
+}
+
 class MgServerFeatureUtil
 {
 public:
@@ -130,6 +135,8 @@
     static void UpdateObjectPropertyDefinition(MgObjectPropertyDefinition* objPropDef, FdoObjectPropertyDefinition* fdoPropDef, FdoClassCollection* fdoClassCol);
     static void UpdateGeometricPropertyDefinition(MgGeometricPropertyDefinition* mgPropDef, FdoGeometricPropertyDefinition* fdoPropDef);
     static void UpdateRasterPropertyDefinition(MgRasterPropertyDefinition* mgPropDef, FdoRasterPropertyDefinition* fdoPropDef);
+
+    static MgFeatureReader* ExecuteQueryDefinition(MgFeatureService* featureService, MdfModel::QueryDefinition* qdef, MgPropertyCollection* queryParameters);
 private:
     static bool Initialize();
 

Added: sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.cpp	                        (rev 0)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,891 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+#include "ServerQueryDefinitionReader.h"
+#include "ServerFeatureUtil.h"
+
+//NOTE: MgServerQueryDefinitionReader is a MgFeatureReader facade for *vector* data queries, thus any raster
+//related APIs that we cannot pass down to the underlying reader, we don't implement.
+
+MgServerQueryDefinitionReader::MgServerQueryDefinitionReader(MgReader* innerReader, MgClassDefinition* classDef)
+{
+    CHECKARGUMENTNULL(innerReader, L"MgServerQueryDefinitionReader.MgServerQueryDefinitionReader");
+    CHECKARGUMENTNULL(classDef, L"MgServerQueryDefinitionReader.MgServerQueryDefinitionReader");
+
+    m_innerReader = SAFE_ADDREF(innerReader);
+    m_classDef = SAFE_ADDREF(classDef);
+    m_featureSet = NULL;
+}
+
+MgServerQueryDefinitionReader::~MgServerQueryDefinitionReader()
+{
+    MG_TRY()
+    Close();
+    MG_CATCH_AND_RELEASE()
+
+    m_innerReader = NULL;
+    m_classDef = NULL;
+    m_featureSet = NULL;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Advances the reader to the next item and returns true if there is
+/// another object to read or false if reading is complete. The default
+/// position of the reader is prior to the first item. Thus you must
+/// call ReadNext to begin accessing any data.
+/// </summary>
+/// <returns>
+/// Returns true if there is a next item.
+/// </returns>
+bool MgServerQueryDefinitionReader::ReadNext()
+{
+    return m_innerReader->ReadNext();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the definition of the object currently being read. If the user
+/// has requested only a subset of the class properties, the class
+/// definition reflects what the user has asked, rather than the full class
+/// definition.
+/// </summary>
+/// <returns>A MgClassDefinition representing the current object
+///</returns>
+MgClassDefinition* MgServerQueryDefinitionReader::GetClassDefinition()
+{
+    return SAFE_ADDREF(m_classDef.p);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+///  Returns true if the value of the specified property is null.
+/// </summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgServerQueryDefinitionReader::IsNull(CREFSTRING propertyName)
+{
+    return m_innerReader->IsNull(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Boolean value of the specified property. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the Boolean value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not boolean
+bool MgServerQueryDefinitionReader::GetBoolean(CREFSTRING propertyName)
+{
+    return m_innerReader->GetBoolean(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Byte value of the specified property. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the Byte value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not byte
+BYTE MgServerQueryDefinitionReader::GetByte(CREFSTRING propertyName)
+{
+    return m_innerReader->GetByte(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the DTime value of the specified property. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the DTime value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not date/time
+MgDateTime* MgServerQueryDefinitionReader::GetDateTime(CREFSTRING propertyName)
+{
+    return m_innerReader->GetDateTime(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Single value of the specified property. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the single value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not float
+float MgServerQueryDefinitionReader::GetSingle(CREFSTRING propertyName)
+{
+    return m_innerReader->GetSingle(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Double value of the specified property. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the double value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not double
+double MgServerQueryDefinitionReader::GetDouble(CREFSTRING propertyName)
+{
+    return m_innerReader->GetDouble(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the integer 16 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not int16
+INT16 MgServerQueryDefinitionReader::GetInt16(CREFSTRING propertyName)
+{
+    return m_innerReader->GetInt16(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the integer 32 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not int32
+INT32 MgServerQueryDefinitionReader::GetInt32(CREFSTRING propertyName)
+{
+    return m_innerReader->GetInt32(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the integer 64 bits value of the specified property. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not int64
+INT64 MgServerQueryDefinitionReader::GetInt64(CREFSTRING propertyName)
+{
+    return m_innerReader->GetInt64(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the string value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a string
+STRING MgServerQueryDefinitionReader::GetString(CREFSTRING propertyName)
+{
+    return m_innerReader->GetString(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the BLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the BLOB value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a BLOB
+MgByteReader* MgServerQueryDefinitionReader::GetBLOB(CREFSTRING propertyName)
+{
+    return m_innerReader->GetBLOB(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the CLOB value of the specified property. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the CLOB value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a CLOB
+MgByteReader* MgServerQueryDefinitionReader::GetCLOB(CREFSTRING propertyName)
+{
+    return m_innerReader->GetCLOB(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the FeatureReader to access this object value.
+/// The property must be of an object type; otherwise, the result is NULL.
+/// </summary>
+/// <param name="propertyName">Input the property name.</param>
+/// <returns>Returns the feature reader to access this object.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a feature
+MgFeatureReader* MgServerQueryDefinitionReader::GetFeatureObject(CREFSTRING propertyName)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.GetFeatureObject", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the geometry value of the specified property as a GeometryReader.
+/// Because no conversion is performed, the property must be
+/// of Geometric type; otherwise, the result is NULL.</summary>
+/// <param name="propertyName">Input the property name.</param>
+/// <returns>Returns the Geometry object.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not geometry
+MgByteReader* MgServerQueryDefinitionReader::GetGeometry(CREFSTRING propertyName)
+{
+    return m_innerReader->GetGeometry(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// </summary>
+/// <param name="propertyName">Input the property name.</param>
+/// <returns>Returns the Raster object.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not geometry
+MgRaster* MgServerQueryDefinitionReader::GetRaster(CREFSTRING propertyName)
+{
+    return m_innerReader->GetRaster(propertyName);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+///  Returns true if the value of the property at the specified index is null.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns true if the value is null.</returns>
+bool MgServerQueryDefinitionReader::IsNull(INT32 index)
+{
+    return m_innerReader->IsNull(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Boolean value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of boolean type the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Boolean value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not boolean
+bool MgServerQueryDefinitionReader::GetBoolean(INT32 index)
+{
+    return m_innerReader->GetBoolean(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Byte value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of byte type or the result
+/// is undertermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Byte value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not byte
+BYTE MgServerQueryDefinitionReader::GetByte(INT32 index)
+{
+    return m_innerReader->GetByte(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the DTime value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of date type or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the DTime value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not date/time
+MgDateTime* MgServerQueryDefinitionReader::GetDateTime(INT32 index)
+{
+    return m_innerReader->GetDateTime(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Single value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type single or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the single value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not float
+float MgServerQueryDefinitionReader::GetSingle(INT32 index)
+{
+    return m_innerReader->GetSingle(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Double value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type double or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the double value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not double
+double MgServerQueryDefinitionReader::GetDouble(INT32 index)
+{
+    return m_innerReader->GetDouble(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the integer 16 bits value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type integer 16 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 16 bits value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not int16
+INT16 MgServerQueryDefinitionReader::GetInt16(INT32 index)
+{
+    return m_innerReader->GetInt16(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the integer 32 bits value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type integer 32 bits or the result
+/// is undetermined</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 32 bits value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not int32
+INT32 MgServerQueryDefinitionReader::GetInt32(INT32 index)
+{
+    return m_innerReader->GetInt32(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the integer 64 bits value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type integer 64 bits or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the integer 64 bits value.
+/// Note: INT64 is actually a pointer to an Integer64 object
+///</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not int64
+INT64 MgServerQueryDefinitionReader::GetInt64(INT32 index)
+{
+    return m_innerReader->GetInt64(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a string
+STRING MgServerQueryDefinitionReader::GetString(INT32 index)
+{
+    return m_innerReader->GetString(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the BLOB value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type BLOBs or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the BLOB value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a BLOB
+MgByteReader* MgServerQueryDefinitionReader::GetBLOB(INT32 index)
+{
+    return m_innerReader->GetBLOB(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the CLOB value of the property at the specified index. No conversion is
+/// performed, thus the property must be a of type CLOB or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the CLOB value.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a CLOB
+MgByteReader* MgServerQueryDefinitionReader::GetCLOB(INT32 index)
+{
+    return m_innerReader->GetCLOB(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the FeatureReader to access this object value.
+/// The property must be of an object type; otherwise, the result is NULL.
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the feature reader to access this object.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not a feature
+MgFeatureReader* MgServerQueryDefinitionReader::GetFeatureObject(INT32 index)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.GetFeatureObject", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the geometry value of the property at the specified index as a GeometryReader.
+/// Because no conversion is performed, the property must be
+/// of Geometric type; otherwise, the result is NULL.</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Geometry object.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not geometry
+MgByteReader* MgServerQueryDefinitionReader::GetGeometry(INT32 index)
+{
+    return m_innerReader->GetGeometry(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// </summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the Raster object.</returns>
+/// EXCEPTIONS:
+/// MgInvalidArgumentException if the property type is not geometry
+MgRaster* MgServerQueryDefinitionReader::GetRaster(INT32 index)
+{
+    return m_innerReader->GetRaster(index);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Serializes all features into an XML.
+/// XML is serialized from the current position of feature reader in the order
+/// data are retrieved.
+/// <returns>MgByteReader holding XML.</returns>
+MgByteReader* MgServerQueryDefinitionReader::ToXml()
+{
+    return m_innerReader->ToXml();
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Releases all the resources of feature reader.
+/// This must be called when user is done with Feature Reader
+/// <returns>Nothing</returns>
+void MgServerQueryDefinitionReader::Close()
+{
+    m_innerReader->Close();
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the starting element name as a UTF-8 string. The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+string MgServerQueryDefinitionReader::GetResponseElementName()
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.GetResponseElementName", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the body starting element name as a UTF-8 string. The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+string MgServerQueryDefinitionReader::GetBodyElementName()
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.GetBodyElementName", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the start of the response as a UTF-8 string. The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+void MgServerQueryDefinitionReader::ResponseStartUtf8(string& str)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.ResponseStartUtf8", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the end of the response as a UTF-8 string. The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+void MgServerQueryDefinitionReader::ResponseEndUtf8(string& str)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.ResponseEndUtf8", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the start of the response body as a UTF-8 string. The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+void MgServerQueryDefinitionReader::BodyStartUtf8(string& str)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.BodyStartUtf8", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the end of the response body as a UTF-8 string. The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+void MgServerQueryDefinitionReader::BodyEndUtf8(string& str)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.BodyEndUtf8", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the contents of the header in this reader as a UTF-8 string.  The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+void MgServerQueryDefinitionReader::HeaderToStringUtf8(string& str)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.HeaderToStringUtf8", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the contents of the current record/feature in the reader as a UTF-8 string.  The mime
+/// type must be a text type, for example text/xml.
+///
+/// \param str
+/// Destination string.
+///
+void MgServerQueryDefinitionReader::CurrentToStringUtf8(string& str)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.CurrentToStringUtf8", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the definition of the object currently being read. If the user
+/// has requested only a subset of the class properties, the class
+/// definition reflects what the user has asked, rather than the full class
+/// definition.
+/// </summary>
+/// <returns>A MgClassDefinition representing the current object
+///</returns>
+/// NOTE: This is internal API used by the mapping service
+/// in the case where we do not want to spend time
+/// serializing the class definition to XML
+MgClassDefinition* MgServerQueryDefinitionReader::GetClassDefinitionNoXml()
+{
+    return SAFE_ADDREF(m_classDef.p);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Geometry for the specified property. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns a ByteReader object</returns>
+BYTE_ARRAY_OUT MgServerQueryDefinitionReader::GetGeometry(CREFSTRING propertyName, INT32& length)
+{
+    //Pass the buck if it's the right reader type, otherwise we're not implemented
+    if (m_innerReader->GetReaderType() == MgReaderType::FeatureReader)
+    {
+        return ((MgFeatureReader*)m_innerReader.p)->GetGeometry(propertyName, length);
+    }
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.GetGeometry", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the Geometry for the property at the specified index. No conversion is
+/// performed, thus the property must be a of type Geometry or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns a ByteReader object</returns>
+BYTE_ARRAY_OUT MgServerQueryDefinitionReader::GetGeometry(INT32 index, INT32& length)
+{
+    //Pass the buck if it's the right reader type, otherwise we're not implemented
+    if (m_innerReader->GetReaderType() == MgReaderType::FeatureReader)
+    {
+        return ((MgFeatureReader*)m_innerReader.p)->GetGeometry(index, length);
+    }
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.GetGeometry", __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="propertyName">Property name.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgServerQueryDefinitionReader::GetString(CREFSTRING propertyName, INT32& length)
+{
+    return m_innerReader->GetString(propertyName, length);
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the string value of the specified property. No conversion is
+/// performed, thus the property must be a of type string or the result
+/// is NULL</summary>
+/// <param name="index">Property index.</param>
+/// <returns>Returns the string value.</returns>
+const wchar_t* MgServerQueryDefinitionReader::GetString(INT32 index, INT32& length)
+{
+    STRING propName = m_innerReader->GetPropertyName(index);
+    return m_innerReader->GetString(propName, length);
+}
+
+//////////////////////////////////////////////////////////////////
+///<summary>
+/// Serialize data to TCP/IP stream
+///</summary>
+///<param name="stream">
+/// Stream
+///</param>
+
+void MgServerQueryDefinitionReader::Serialize(MgStream* stream)
+{
+    INT32 count = 1; // Get value from MgConfiguration
+    bool operationCompleted = false;
+    Ptr<MgFeatureSet> featureSet;
+    STRING featureReader = L"";
+
+    MG_FEATURE_SERVICE_TRY()
+
+    // Find out the counts from Configuration
+    MgConfiguration* config = MgConfiguration::GetInstance();
+
+    config->GetIntValue(MgConfigProperties::FeatureServicePropertiesSection,
+                        MgConfigProperties::FeatureServicePropertyDataCacheSize,
+                        count,
+                        MgConfigProperties::DefaultFeatureServicePropertyDataCacheSize);
+
+    // Collect the feature reader into a pool for ReadNext operation
+    MgServerFeatureReaderPool* featPool = MgServerFeatureReaderPool::GetInstance();
+    CHECKNULL(featPool, L"MgServerFeatureReader.Serialize");
+
+    featureReader = featPool->GetReaderId(this);
+    if (L"" == featureReader)
+    {
+        // The feature reader is not in the pool
+        featureReader = featPool->Add(this); // Add the reference
+    }
+
+    featureSet = GetFeatures(count);
+
+    operationCompleted = true;
+
+    MG_FEATURE_SERVICE_CATCH(L"MgServerFeatureReader.Serialize");
+
+    // Mark operation is completed successfully
+    stream->WriteBoolean(operationCompleted);
+
+    if (operationCompleted && (mgException == 0))
+    {
+        stream->WriteString(featureReader); // Write the reader ID so we can retrieve it for later use
+        stream->WriteObject((MgFeatureSet*)featureSet); // Write the feature set
+    }
+    else
+    {
+        stream->WriteObject((MgException*)mgException);
+    }
+
+    // Serialize method must not THROW the exception because it has already been written to the stream
+    // and in doing so would only end up writing the same exception to the stream twice.
+}
+
+//////////////////////////////////////////////////////////////////
+///<summary>
+/// Deserialize data from TCP/IP stream
+///</summary>
+///<param name="stream">
+/// Stream
+///</param>
+
+void MgServerQueryDefinitionReader::Deserialize(MgStream* stream)
+{
+    throw new MgInvalidOperationException(L"MgServerQueryDefinitionReader.Deserialize",
+        __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+MgFeatureSet* MgServerQueryDefinitionReader::GetFeatures(INT32 count)
+{
+    CHECKNULL((MgReader*)m_innerReader, L"MgServerQueryDefinitionReader.GetFeatures");
+
+    MG_FEATURE_SERVICE_TRY()
+
+    INT32 featCount = count;
+
+    if (NULL == (MgClassDefinition*)m_classDef)
+    {
+        // Get MgClassDefinition
+        m_classDef = GetClassDefinition();
+        CHECKNULL(m_classDef.p, L"MgServerQueryDefinitionReader.GetFeatures");
+    }
+
+    if (NULL == (MgFeatureSet*)m_featureSet)
+    {
+        // Create a feature set for a pool of features
+        m_featureSet = new MgFeatureSet();
+        CHECKNULL((MgFeatureSet*)m_featureSet, L"MgServerQueryDefinitionReader.GetFeatures");
+
+        // Assign feature class definition to Feature Set
+        m_featureSet->SetClassDefinition(m_classDef);
+    }
+    else
+    {
+        m_featureSet->ClearFeatures();
+    }
+
+    // If class definition contains raster property
+    // we can only retrieve one feature at a time
+    // because, user would need to supply x,y and extents before
+    // they could fetch the raster data. Therefore we can not
+    // advance FdoIReader.
+    if (m_classDef->HasRasterProperty())
+    {
+        featCount = 1;
+    }
+
+    // Add all features to feature set
+    AddFeatures(featCount);
+
+    MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetFeatures")
+
+    return SAFE_ADDREF((MgFeatureSet*)m_featureSet);
+}
+
+void MgServerQueryDefinitionReader::Dispose() { delete this; }
+
+void MgServerQueryDefinitionReader::AddFeatures(INT32 count)
+{
+    CHECKNULL((MgReader*)m_innerReader, L"MgServerFeatureReader.AddFeatures");
+    CHECKNULL((MgFeatureSet*)m_featureSet, L"MgServerFeatureReader.AddFeatures");
+
+    INT32 desiredFeatures = 0;
+
+    // Access the class definition
+    Ptr<MgClassDefinition> classDef = m_featureSet->GetClassDefinition();
+    CHECKNULL((MgClassDefinition*)classDef, L"MgServerFeatureReader.AddFeatures");
+
+    // Access the property definition collection
+    // Ptr<MgPropertyDefinitionCollection> propDefCol = classDef->GetProperties();
+    Ptr<MgPropertyDefinitionCollection> propDefCol = classDef->GetPropertiesIncludingBase();
+    CHECKNULL((MgPropertyDefinitionCollection*)propDefCol, L"MgServerFeatureReader.AddFeatures");
+
+    // How many properties are we fetching, it should be atleast one
+    INT32 cnt = propDefCol->GetCount();
+
+    // We only read if there is atleast one property requested
+    if (cnt > 0 && count > 0)
+    {
+        try
+        {
+            while (m_innerReader->ReadNext())
+            {
+                AddFeature((MgPropertyDefinitionCollection*)propDefCol);
+
+                // Collected required features therefore do not process more
+                if (++desiredFeatures == count)
+                    break;
+            }
+        }
+        //some providers will throw if ReadNext is called more than once
+        catch (FdoException* e)
+        {
+            // Note: VB 05/10/06 The assert has been commented out as
+            // Linux does not remove them from a release build. The assert
+            // will cause the server to crash on Linux. The Oracle provider will throw
+            // an exception if the ReadNext() method is called after it returns false.
+            // This is a known problem and it is safe to ignore the exception.
+            //assert(false);
+            e->Release();
+        }
+        catch(...)
+        {
+        }
+    }
+}
+
+void MgServerQueryDefinitionReader::AddFeature(MgPropertyDefinitionCollection* propDefCol)
+{
+    CHECKNULL((MgReader*)m_innerReader, L"MgServerQueryDefinitionReader.AddFeature");
+    CHECKARGUMENTNULL((MgPropertyDefinitionCollection*)propDefCol, L"MgServerQueryDefinitionReader.AddFeature");
+
+    //intentionally turn off duplicate checking for better performance
+    Ptr<MgPropertyCollection> propCol = new MgPropertyCollection(true, true);
+    INT32 cnt = propDefCol->GetCount();
+
+    for (INT32 i=0; i < cnt; i++)
+    {
+        // Access the property definition
+        Ptr<MgPropertyDefinition> propDef = propDefCol->GetItem(i);
+
+        // Get the name of property
+        STRING propName = propDef->GetName();
+
+        INT16 type = MgServerFeatureUtil::GetMgPropertyType(propDef);
+        Ptr<MgProperty> prop = MgServerFeatureUtil::GetMgProperty(this, propName, type);
+        if (prop != NULL)
+        {
+            propCol->Add(prop);
+        }
+    }
+
+    m_featureSet->AddFeature(propCol);
+}
+
+MgByteReader* MgServerQueryDefinitionReader::GetRaster(STRING rasterPropName, INT32 xSize, INT32 ySize)
+{
+    throw new MgNotImplementedException(L"MgServerQueryDefinitionReader.GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
+}
\ No newline at end of file

Added: sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.h
===================================================================
--- sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.h	                        (rev 0)
+++ sandbox/jng/querydef/Server/src/Services/Feature/ServerQueryDefinitionReader.h	2013-04-30 20:43:25 UTC (rev 7466)
@@ -0,0 +1,576 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef _MG_SERVER_QUERY_DEFINITION_READER_H
+#define _MG_SERVER_QUERY_DEFINITION_READER_H
+
+#include "ServerFeatureDllExport.h"
+#include "ServerFeatureServiceDefs.h"
+
+/////////////////////////////////////////////////////////////////
+///<summary>
+/// The FeatureReader class provides a one way iterator for reading feature data.
+/// The initial position of the FeatureReader is prior to
+/// the first item.  ReadNext should be called to begin accessing the data.
+/// GetClassDefintion returns the feature class definition for
+/// the feature data.  The Get* methods operate on the current feature.  The
+/// next feature is obtained by calling ReadNext.
+///</summary>
+
+class MG_SERVER_FEATURE_API MgServerQueryDefinitionReader : public MgFeatureReader
+{
+EXTERNAL_API:
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Advances the reader to the next item and returns true if there is
+    /// another object to read or false if reading is complete. The default
+    /// position of the reader is prior to the first item. Thus you must
+    /// call ReadNext to begin accessing any data.
+    /// </summary>
+    /// <returns>
+    /// Returns true if there is a next item.
+    /// </returns>
+    bool ReadNext();
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the definition of the object currently being read. If the user
+    /// has requested only a subset of the class properties, the class
+    /// definition reflects what the user has asked, rather than the full class
+    /// definition.
+    /// </summary>
+    /// <returns>A MgClassDefinition representing the current object
+    ///</returns>
+    MgClassDefinition* GetClassDefinition();
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    ///  Returns true if the value of the specified property is null.
+    /// </summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns true if the value is null.</returns>
+    bool IsNull(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Boolean value of the specified property. No conversion is
+    /// performed, thus the property must be a of boolean type the result
+    /// is undertermined</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the Boolean value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not boolean
+    bool GetBoolean(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Byte value of the specified property. No conversion is
+    /// performed, thus the property must be a of byte type or the result
+    /// is undertermined</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the Byte value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not byte
+    BYTE GetByte(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the DTime value of the specified property. No conversion is
+    /// performed, thus the property must be a of date type or the result
+    /// is NULL</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the DTime value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not date/time
+    MgDateTime* GetDateTime(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Single value of the specified property. No conversion is
+    /// performed, thus the property must be a of type single or the result
+    /// is undetermined</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the single value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not float
+    float GetSingle(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Double value of the specified property. No conversion is
+    /// performed, thus the property must be a of type double or the result
+    /// is undetermined</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the double value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not double
+    double GetDouble(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the integer 16 bits value of the specified property. No conversion is
+    /// performed, thus the property must be a of type integer 16 bits or the result
+    /// is undetermined</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the integer 16 bits value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not int16
+    INT16 GetInt16(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the integer 32 bits value of the specified property. No conversion is
+    /// performed, thus the property must be a of type integer 32 bits or the result
+    /// is undetermined</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the integer 32 bits value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not int32
+    INT32 GetInt32(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the integer 64 bits value of the specified property. No conversion is
+    /// performed, thus the property must be a of type integer 64 bits or the result
+    /// is NULL</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the integer 64 bits value.
+    /// Note: INT64 is actually a pointer to an Integer64 object
+    ///</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not int64
+    INT64 GetInt64(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the string value of the specified property. No conversion is
+    /// performed, thus the property must be a of type string or the result
+    /// is NULL</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the string value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a string
+    STRING GetString(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the BLOB value of the specified property. No conversion is
+    /// performed, thus the property must be a of type BLOBs or the result
+    /// is NULL</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the BLOB value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a BLOB
+    MgByteReader* GetBLOB(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the CLOB value of the specified property. No conversion is
+    /// performed, thus the property must be a of type CLOB or the result
+    /// is NULL</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the CLOB value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a CLOB
+    MgByteReader* GetCLOB(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the FeatureReader to access this object value.
+    /// The property must be of an object type; otherwise, the result is NULL.
+    /// </summary>
+    /// <param name="propertyName">Input the property name.</param>
+    /// <returns>Returns the feature reader to access this object.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a feature
+    MgFeatureReader* GetFeatureObject(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the geometry value of the specified property as a GeometryReader.
+    /// Because no conversion is performed, the property must be
+    /// of Geometric type; otherwise, the result is NULL.</summary>
+    /// <param name="propertyName">Input the property name.</param>
+    /// <returns>Returns the Geometry object.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not geometry
+    MgByteReader* GetGeometry(CREFSTRING propertyName);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// </summary>
+    /// <param name="propertyName">Input the property name.</param>
+    /// <returns>Returns the Raster object.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not geometry
+    MgRaster* GetRaster(CREFSTRING propertyName);
+
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    ///  Returns true if the value of the property at the specified index is null.
+    /// </summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns true if the value is null.</returns>
+    bool IsNull(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Boolean value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of boolean type the result
+    /// is undertermined</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the Boolean value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not boolean
+    bool GetBoolean(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Byte value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of byte type or the result
+    /// is undertermined</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the Byte value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not byte
+    BYTE GetByte(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the DTime value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of date type or the result
+    /// is NULL</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the DTime value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not date/time
+    MgDateTime* GetDateTime(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Single value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type single or the result
+    /// is undetermined</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the single value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not float
+    float GetSingle(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Double value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type double or the result
+    /// is undetermined</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the double value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not double
+    double GetDouble(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the integer 16 bits value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type integer 16 bits or the result
+    /// is undetermined</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the integer 16 bits value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not int16
+    INT16 GetInt16(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the integer 32 bits value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type integer 32 bits or the result
+    /// is undetermined</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the integer 32 bits value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not int32
+    INT32 GetInt32(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the integer 64 bits value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type integer 64 bits or the result
+    /// is NULL</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the integer 64 bits value.
+    /// Note: INT64 is actually a pointer to an Integer64 object
+    ///</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not int64
+    INT64 GetInt64(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the string value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type string or the result
+    /// is NULL</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the string value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a string
+    STRING GetString(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the BLOB value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type BLOBs or the result
+    /// is NULL</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the BLOB value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a BLOB
+    MgByteReader* GetBLOB(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the CLOB value of the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type CLOB or the result
+    /// is NULL</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the CLOB value.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a CLOB
+    MgByteReader* GetCLOB(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the FeatureReader to access this object value.
+    /// The property must be of an object type; otherwise, the result is NULL.
+    /// </summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the feature reader to access this object.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not a feature
+    MgFeatureReader* GetFeatureObject(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the geometry value of the property at the specified index as a GeometryReader.
+    /// Because no conversion is performed, the property must be
+    /// of Geometric type; otherwise, the result is NULL.</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the Geometry object.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not geometry
+    MgByteReader* GetGeometry(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// </summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the Raster object.</returns>
+    /// EXCEPTIONS:
+    /// MgInvalidArgumentException if the property type is not geometry
+    MgRaster* GetRaster(INT32 index);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Serializes all features into an XML.
+    /// XML is serialized from the current position of feature reader in the order
+    /// data are retrieved.
+    /// <returns>MgByteReader holding XML.</returns>
+    MgByteReader* ToXml();
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Releases all the resources of feature reader.
+    /// This must be called when user is done with Feature Reader
+    /// <returns>Nothing</returns>
+    void Close();
+
+INTERNAL_API:
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    string GetResponseElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the body starting element name as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    string GetBodyElementName();
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the start of the response as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    void ResponseStartUtf8(string& str);
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the end of the response as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    void ResponseEndUtf8(string& str);
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the start of the response body as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    void BodyStartUtf8(string& str);
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the end of the response body as a UTF-8 string. The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    void BodyEndUtf8(string& str);
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the contents of the header in this reader as a UTF-8 string.  The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    void HeaderToStringUtf8(string& str);
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the contents of the current record/feature in the reader as a UTF-8 string.  The mime
+    /// type must be a text type, for example text/xml.
+    ///
+    /// \param str
+    /// Destination string.
+    ///
+    void CurrentToStringUtf8(string& str);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the definition of the object currently being read. If the user
+    /// has requested only a subset of the class properties, the class
+    /// definition reflects what the user has asked, rather than the full class
+    /// definition.
+    /// </summary>
+    /// <returns>A MgClassDefinition representing the current object
+    ///</returns>
+    /// NOTE: This is internal API used by the mapping service
+    /// in the case where we do not want to spend time
+    /// serializing the class definition to XML
+    MgClassDefinition* GetClassDefinitionNoXml();
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Geometry for the specified property. No conversion is
+    /// performed, thus the property must be a of type Geometry or the result
+    /// is NULL</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns a ByteReader object</returns>
+    BYTE_ARRAY_OUT GetGeometry(CREFSTRING propertyName, INT32& length);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the Geometry for the property at the specified index. No conversion is
+    /// performed, thus the property must be a of type Geometry or the result
+    /// is NULL</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns a ByteReader object</returns>
+    BYTE_ARRAY_OUT GetGeometry(INT32 index, INT32& length);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the string value of the specified property. No conversion is
+    /// performed, thus the property must be a of type string or the result
+    /// is NULL</summary>
+    /// <param name="propertyName">Property name.</param>
+    /// <returns>Returns the string value.</returns>
+    const wchar_t* GetString(CREFSTRING propertyName, INT32& length);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets the string value of the specified property. No conversion is
+    /// performed, thus the property must be a of type string or the result
+    /// is NULL</summary>
+    /// <param name="index">Property index.</param>
+    /// <returns>Returns the string value.</returns>
+    const wchar_t* GetString(INT32 index, INT32& length);
+
+    //////////////////////////////////////////////////////////////////
+    ///<summary>
+    /// Serialize data to TCP/IP stream
+    ///</summary>
+    ///<param name="stream">
+    /// Stream
+    ///</param>
+
+    virtual void Serialize(MgStream* stream);
+
+    //////////////////////////////////////////////////////////////////
+    ///<summary>
+    /// Deserialize data from TCP/IP stream
+    ///</summary>
+    ///<param name="stream">
+    /// Stream
+    ///</param>
+
+    virtual void Deserialize(MgStream* stream);
+
+    virtual MgFeatureSet* GetFeatures(INT32 count);
+    void AddFeatures(INT32 count);
+    void AddFeature(MgPropertyDefinitionCollection* propDefCol);
+
+    MgServerQueryDefinitionReader(MgReader* innerReader, MgClassDefinition* classDef);
+    ~MgServerQueryDefinitionReader();
+
+    virtual void Dispose();
+
+    virtual INT32 GetClassId() { return m_cls_id; }
+
+    //FdoIFeatureReader* GetInternalReader() { return FDO_SAFE_ADDREF(m_fdoReader); }
+    
+    MgByteReader* GetRaster(STRING rasterPropName, INT32 xSize, INT32 ySize);
+
+private:
+    Ptr<MgClassDefinition> m_classDef;
+    Ptr<MgFeatureSet> m_featureSet;
+    Ptr<MgReader> m_innerReader;
+
+CLASS_ID:
+    static const INT32 m_cls_id = PlatformBase_FeatureService_FeatureReader;
+};
+#endif
\ No newline at end of file

Modified: sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp
===================================================================
--- sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/Server/src/UnitTesting/TestFeatureService.cpp	2013-04-30 20:43:25 UTC (rev 7466)
@@ -3167,7 +3167,7 @@
 
         INT64 count = fr->GetInt64(L"RecordCount");
         INT64 count2 = fr->GetInt64(fr->GetPropertyIndex(L"RecordCount"));
-        CPPUNIT_ASSERT(17565L == count);
+        CPPUNIT_ASSERT(80 == count);
         CPPUNIT_ASSERT(count == count2);
         bRead  = fr->ReadNext();
         CPPUNIT_ASSERT(!bRead);
@@ -3272,16 +3272,17 @@
         CPPUNIT_ASSERT(L"QueryDefault" == ((MgGeometricPropertyDefinition*)prop3.p)->GetSpatialContextAssociation());
 
         Ptr<MgAgfReaderWriter> agfRw = new MgAgfReaderWriter();
+        Ptr<MgWktReaderWriter> wktRw = new MgWktReaderWriter();
 
         //Test spatial contexts
         Ptr<MgSpatialContextReader> scReader = pService->GetSpatialContexts(qryId, false);
         bool bRead = scReader->ReadNext();
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
-        CPPUNIT_ASSERT(L"Default" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -3301,10 +3302,10 @@
         bRead = scReader->ReadNext();
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
-        CPPUNIT_ASSERT(L"Default" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -3338,7 +3339,14 @@
         //Huh? MgFeatureReader inherits MgReader! Why you don't let me?
         Ptr<MgByteReader> bbox = ((MgReader*)fr)->GetGeometry(L"MyExtents");
         Ptr<MgByteReader> bbox2 = ((MgReader*)fr)->GetGeometry(fr->GetPropertyIndex(L"MyExtents"));
-        CPPUNIT_ASSERT(bbox == bbox2);
+
+        Ptr<MgGeometry> gBox = agfRw->Read(bbox);
+        Ptr<MgGeometry> gBox2 = agfRw->Read(bbox2);
+
+        STRING wkt = wktRw->Write(gBox);
+        STRING wkt2 = wktRw->Write(gBox2);
+
+        CPPUNIT_ASSERT(wkt == wkt2);
         bRead  = fr->ReadNext();
         CPPUNIT_ASSERT(!bRead);
         fr->Close();
@@ -3458,9 +3466,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -3481,9 +3489,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -3645,7 +3653,7 @@
         CPPUNIT_ASSERT(3 == fr->GetPropertyCount());
         CPPUNIT_ASSERT(fr->GetPropertyIndex(L"Geometry") >= 0);
         CPPUNIT_ASSERT(fr->GetPropertyIndex(L"SdfId") >= 0);
-        CPPUNIT_ASSERT(fr->GetPropertyIndex(L"MyCurrentDate") >= 0);
+        CPPUNIT_ASSERT(fr->GetPropertyIndex(L"ID") >= 0);
         Ptr<MgClassDefinition> clsDef = fr->GetClassDefinition();
         Ptr<MgPropertyDefinitionCollection> clsProps = clsDef->GetProperties();
         Ptr<MgPropertyDefinitionCollection> idProps = clsDef->GetIdentityProperties();
@@ -3654,7 +3662,7 @@
         CPPUNIT_ASSERT(idProps->IndexOf(L"SdfId") >= 0);
         CPPUNIT_ASSERT(clsProps->IndexOf(L"Geometry") >= 0);
         CPPUNIT_ASSERT(clsProps->IndexOf(L"SdfId") >= 0);
-        CPPUNIT_ASSERT(clsProps->IndexOf(L"MyCurrentDate") >= 0);
+        CPPUNIT_ASSERT(clsProps->IndexOf(L"ID") >= 0);
 
         INT32 count = 0;
         while(fr->ReadNext()) {
@@ -3778,9 +3786,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -3801,9 +3809,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -3965,9 +3973,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -3988,9 +3996,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -4031,7 +4039,7 @@
             count++;
         }
         fr->Close();
-        CPPUNIT_ASSERT(17565 == count);
+        CPPUNIT_ASSERT(80 == count);
     }
     catch(MgException* e)
     {
@@ -4148,9 +4156,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -4171,9 +4179,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -4287,10 +4295,13 @@
         Ptr<MgPropertyDefinitionCollection> klassIdProps = klass->GetIdentityProperties();
         Ptr<MgPropertyDefinitionCollection> klassIdProps2 = klass2->GetIdentityProperties();
         Ptr<MgPropertyDefinitionCollection> klassIdProps3 = klass3->GetIdentityProperties();
-        CPPUNIT_ASSERT(0 == klassIdProps->GetCount());
+        CPPUNIT_ASSERT(1 == klassIdProps->GetCount());
         CPPUNIT_ASSERT(klassIdProps->GetCount() == klassIdProps2->GetCount());
         CPPUNIT_ASSERT(klassIdProps3->GetCount() == klassIdProps2->GetCount());
         //Our property should be here
+        CPPUNIT_ASSERT(klassIdProps->IndexOf(L"RecordCount") >= 0);
+        CPPUNIT_ASSERT(klassIdProps2->IndexOf(L"RecordCount") >= 0);
+        CPPUNIT_ASSERT(klassIdProps3->IndexOf(L"RecordCount") >= 0);
         CPPUNIT_ASSERT(klassProps->IndexOf(L"RecordCount") >= 0);
         CPPUNIT_ASSERT(klassProps2->IndexOf(L"RecordCount") >= 0);
         CPPUNIT_ASSERT(klassProps3->IndexOf(L"RecordCount") >= 0);
@@ -4320,8 +4331,9 @@
         Ptr<MgPropertyDefinitionCollection> clsProps = clsDef->GetProperties();
         Ptr<MgPropertyDefinitionCollection> idProps = clsDef->GetIdentityProperties();
         CPPUNIT_ASSERT(1 == clsProps->GetCount());
-        CPPUNIT_ASSERT(0 == idProps->GetCount());
+        CPPUNIT_ASSERT(1 == idProps->GetCount());
         CPPUNIT_ASSERT(clsProps->IndexOf(L"RecordCount") >= 0);
+        CPPUNIT_ASSERT(idProps->IndexOf(L"RecordCount") >= 0);
 
         INT32 count = 0;
         bRead = fr->ReadNext();
@@ -4449,9 +4461,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -4472,9 +4484,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -4633,9 +4645,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -4656,9 +4668,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -4830,9 +4842,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         Ptr<MgByteReader> scAgf = scReader->GetExtent();
         Ptr<MgGeometry> scGeom = agfRw->Read(scAgf);
@@ -4853,9 +4865,9 @@
         CPPUNIT_ASSERT(bRead); //Query has GeometryInfo so we should have a result
         //Test spatial context reader contents. Should match what we have defined in GeometryInfo
         CPPUNIT_ASSERT(L"QueryDefault" == scReader->GetName());
-        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetName());
-        CPPUNIT_ASSERT(L"LL84" == scReader->GetName());
-        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetName());
+        CPPUNIT_ASSERT(L"Spatial Context for Query Definition" == scReader->GetDescription());
+        CPPUNIT_ASSERT(L"LL84" == scReader->GetCoordinateSystem());
+        CPPUNIT_ASSERT(L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]" == scReader->GetCoordinateSystemWkt());
         CPPUNIT_ASSERT(MgSpatialContextExtentType::scDynamic == scReader->GetExtentType());
         scAgf = scReader->GetExtent();
         scGeom = agfRw->Read(scAgf);
@@ -4903,7 +4915,7 @@
             count++;
         }
         fr->Close();
-        CPPUNIT_ASSERT(80 == count);
+        CPPUNIT_ASSERT(42 == count);
     }
     catch(MgException* e)
     {

Modified: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateCount.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateCount.QueryDefinition	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateCount.QueryDefinition	2013-04-30 20:43:25 UTC (rev 7466)
@@ -7,7 +7,7 @@
     <ComputedProperties>
       <ComputedProperty>
         <Name>RecordCount</Name>
-        <Expression>Count(SdfId)</Expression>
+        <Value>Count(SdfId)</Value>
       </ComputedProperty>
     </ComputedProperties>
   </AggregateQueryDefinition>

Modified: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateSpatialExtents.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateSpatialExtents.QueryDefinition	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_AggregateSpatialExtents.QueryDefinition	2013-04-30 20:43:25 UTC (rev 7466)
@@ -29,7 +29,7 @@
     <ComputedProperties>
       <ComputedProperty>
         <Name>MyExtents</Name>
-        <Expression>SpatialExtents(Geometry)</Expression>
+        <Value>SpatialExtents(Geometry)</Value>
       </ComputedProperty>
     </ComputedProperties>
   </AggregateQueryDefinition>

Modified: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicAllElements.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicAllElements.QueryDefinition	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicAllElements.QueryDefinition	2013-04-30 20:43:25 UTC (rev 7466)
@@ -6,7 +6,7 @@
       <Geometry>Geometry</Geometry>
       <GeometryTypes>7</GeometryTypes>
       <SpatialContext>
-        <Name>Default</Name>
+        <Name>QueryDefault</Name>
         <Description>Spatial Context for Query Definition</Description>
         <CoordinateSystemName>LL84</CoordinateSystemName>
         <CoordinateSystemWkt>GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]</CoordinateSystemWkt>
@@ -37,7 +37,7 @@
     <ComputedProperties>
       <ComputedProperty>
         <Name>MyCurrentDate</Name>
-        <Expression>CurrentDate()</Expression>
+        <Value>CurrentDate()</Value>
       </ComputedProperty>
     </ComputedProperties>
     <OrderBy>

Modified: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithExplicitPropertyList.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithExplicitPropertyList.QueryDefinition	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithExplicitPropertyList.QueryDefinition	2013-04-30 20:43:25 UTC (rev 7466)
@@ -38,11 +38,11 @@
     <ComputedProperties>
       <ComputedProperty>
         <Name>MyCurrentDate</Name>
-        <Expression>CurrentDate()</Expression>
+        <Value>CurrentDate()</Value>
       </ComputedProperty>
       <ComputedProperty>
         <Name>MyIDLength</Name>
-        <Expression>Length(ID)</Expression>
+        <Value>Length(ID)</Value>
       </ComputedProperty>
     </ComputedProperties>
   </FeatureQueryDefinition>

Modified: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithFilter.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithFilter.QueryDefinition	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_BasicWithFilter.QueryDefinition	2013-04-30 20:43:25 UTC (rev 7466)
@@ -6,7 +6,7 @@
       <Geometry>Geometry</Geometry>
       <GeometryTypes>7</GeometryTypes>
       <SpatialContext>
-        <Name>Default</Name>
+        <Name>QueryDefault</Name>
         <Description>Spatial Context for Query Definition</Description>
         <CoordinateSystemName>LL84</CoordinateSystemName>
         <CoordinateSystemWkt>GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]</CoordinateSystemWkt>

Modified: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLBasic.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLBasic.QueryDefinition	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLBasic.QueryDefinition	2013-04-30 20:43:25 UTC (rev 7466)
@@ -6,7 +6,7 @@
       <Geometry>Geometry</Geometry>
       <GeometryTypes>7</GeometryTypes>
       <SpatialContext>
-        <Name>Default</Name>
+        <Name>QueryDefault</Name>
         <Description>Spatial Context for Query Definition</Description>
         <CoordinateSystemName>LL84</CoordinateSystemName>
         <CoordinateSystemWkt>GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]</CoordinateSystemWkt>

Modified: sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLWhereJoin.QueryDefinition
===================================================================
--- sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLWhereJoin.QueryDefinition	2013-04-30 15:21:47 UTC (rev 7465)
+++ sandbox/jng/querydef/UnitTest/TestData/FeatureService/SQLite/UT_SQLWhereJoin.QueryDefinition	2013-04-30 20:43:25 UTC (rev 7466)
@@ -6,7 +6,7 @@
       <Geometry>Geometry</Geometry>
       <GeometryTypes>7</GeometryTypes>
       <SpatialContext>
-        <Name>Default</Name>
+        <Name>QueryDefault</Name>
         <Description>Spatial Context for Query Definition</Description>
         <CoordinateSystemName>LL84</CoordinateSystemName>
         <CoordinateSystemWkt>GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]</CoordinateSystemWkt>



More information about the mapguide-commits mailing list