/// <summary>
        /// Boostrapping all the canonical functions for the EDM Provider Manifest
        /// </summary>
        private void InitializeCanonicalFunctions()
        {
            if (_functions != null)
            {
                return;
            }
                        
            // Ensure primitive types are available
            InitializePrimitiveTypes();

            EdmProviderManifestFunctionBuilder functions = new EdmProviderManifestFunctionBuilder(_primitiveTypes);
            PrimitiveTypeKind[] parameterTypes;
            
            #region Aggregate Functions

            // Max, Min
            parameterTypes = new[] { PrimitiveTypeKind.Byte,
                                     PrimitiveTypeKind.DateTime,
                                     PrimitiveTypeKind.Decimal,
                                     PrimitiveTypeKind.Double,
                                     PrimitiveTypeKind.Int16,
                                     PrimitiveTypeKind.Int32,
                                     PrimitiveTypeKind.Int64,
                                     PrimitiveTypeKind.SByte,
                                     PrimitiveTypeKind.Single,
                                     PrimitiveTypeKind.String,
                                     PrimitiveTypeKind.Binary,
                                     PrimitiveTypeKind.Time,
                                     PrimitiveTypeKind.DateTimeOffset };

            functions.ForTypes(parameterTypes, type => functions.AddAggregate("Max", type));
            functions.ForTypes(parameterTypes, type => functions.AddAggregate("Min", type));

            // Avg, Sum
            parameterTypes = new[] { PrimitiveTypeKind.Decimal,
                                     PrimitiveTypeKind.Double,
                                     PrimitiveTypeKind.Int32,
                                     PrimitiveTypeKind.Int64 };

            functions.ForTypes(parameterTypes, type => functions.AddAggregate("Avg", type));
            functions.ForTypes(parameterTypes, type => functions.AddAggregate("Sum", type));

            // STDEV, STDEVP, VAR, VARP
            parameterTypes = new[] { PrimitiveTypeKind.Decimal,
                                     PrimitiveTypeKind.Double,
                                     PrimitiveTypeKind.Int32,
                                     PrimitiveTypeKind.Int64};

            functions.ForTypes(parameterTypes, type => functions.AddAggregate(PrimitiveTypeKind.Double, "StDev", type));
            functions.ForTypes(parameterTypes, type => functions.AddAggregate(PrimitiveTypeKind.Double, "StDevP", type));
            functions.ForTypes(parameterTypes, type => functions.AddAggregate(PrimitiveTypeKind.Double, "Var", type));
            functions.ForTypes(parameterTypes, type => functions.AddAggregate(PrimitiveTypeKind.Double, "VarP", type));

            // Count and Big Count must be supported for all edm types, except the strong spatial types.
            functions.ForAllBasePrimitiveTypes(type => functions.AddAggregate(PrimitiveTypeKind.Int32, "Count", type));
            functions.ForAllBasePrimitiveTypes(type => functions.AddAggregate(PrimitiveTypeKind.Int64, "BigCount", type));
            
            #endregion

            #region String Functions

            functions.AddFunction(PrimitiveTypeKind.String, "Trim", PrimitiveTypeKind.String, "stringArgument");
            functions.AddFunction(PrimitiveTypeKind.String, "RTrim", PrimitiveTypeKind.String, "stringArgument");
            functions.AddFunction(PrimitiveTypeKind.String, "LTrim", PrimitiveTypeKind.String, "stringArgument");
            functions.AddFunction(PrimitiveTypeKind.String, "Concat", PrimitiveTypeKind.String, "string1", PrimitiveTypeKind.String, "string2");
            functions.AddFunction(PrimitiveTypeKind.Int32, "Length", PrimitiveTypeKind.String, "stringArgument");

            // Substring, Left, Right overloads 
            parameterTypes = new[] { PrimitiveTypeKind.Byte,
                                     PrimitiveTypeKind.Int16,
                                     PrimitiveTypeKind.Int32,
                                     PrimitiveTypeKind.Int64,
                                     PrimitiveTypeKind.SByte };

            functions.ForTypes(parameterTypes, type => functions.AddFunction(PrimitiveTypeKind.String, "Substring", PrimitiveTypeKind.String, "stringArgument", type, "start", type, "length"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(PrimitiveTypeKind.String, "Left", PrimitiveTypeKind.String, "stringArgument", type, "length"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(PrimitiveTypeKind.String, "Right", PrimitiveTypeKind.String, "stringArgument", type, "length"));
            
            functions.AddFunction(PrimitiveTypeKind.String,  "Replace", PrimitiveTypeKind.String, "stringArgument", PrimitiveTypeKind.String, "toReplace", PrimitiveTypeKind.String, "replacement");
            functions.AddFunction(PrimitiveTypeKind.Int32,   "IndexOf", PrimitiveTypeKind.String, "searchString", PrimitiveTypeKind.String, "stringToFind");
            functions.AddFunction(PrimitiveTypeKind.String,  "ToUpper", PrimitiveTypeKind.String, "stringArgument");
            functions.AddFunction(PrimitiveTypeKind.String,  "ToLower", PrimitiveTypeKind.String, "stringArgument");
            functions.AddFunction(PrimitiveTypeKind.String,  "Reverse", PrimitiveTypeKind.String, "stringArgument");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "Contains", PrimitiveTypeKind.String, "searchedString", PrimitiveTypeKind.String, "searchedForString");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "StartsWith", PrimitiveTypeKind.String, "stringArgument", PrimitiveTypeKind.String, "prefix");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "EndsWith", PrimitiveTypeKind.String, "stringArgument", PrimitiveTypeKind.String, "suffix");
            
            #endregion

            #region DateTime Functions
            
            PrimitiveTypeKind[] dateTimeParameterTypes = { PrimitiveTypeKind.DateTimeOffset,
                                                           PrimitiveTypeKind.DateTime };
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "Year", type, "dateValue"));
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "Month", type, "dateValue"));
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "Day", type, "dateValue"));
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DayOfYear", type, "dateValue"));

            PrimitiveTypeKind[] timeParameterTypes = { PrimitiveTypeKind.DateTimeOffset,
                                                       PrimitiveTypeKind.DateTime,
                                                       PrimitiveTypeKind.Time };
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "Hour", type, "timeValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "Minute", type, "timeValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "Second", type, "timeValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "Millisecond", type, "timeValue"));

            functions.AddFunction(PrimitiveTypeKind.DateTime, "CurrentDateTime");
            functions.AddFunction(PrimitiveTypeKind.DateTimeOffset, "CurrentDateTimeOffset");
            functions.AddFunction(PrimitiveTypeKind.Int32, "GetTotalOffsetMinutes", PrimitiveTypeKind.DateTimeOffset, "dateTimeOffsetArgument");
            functions.AddFunction(PrimitiveTypeKind.DateTime, "CurrentUtcDateTime");
            
            //TruncateTime
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(type, "TruncateTime", type, "dateValue"));
            
            //DateTime constructor
            functions.AddFunction(PrimitiveTypeKind.DateTime, "CreateDateTime", PrimitiveTypeKind.Int32, "year",
                                                                                PrimitiveTypeKind.Int32, "month",
                                                                                PrimitiveTypeKind.Int32, "day",
                                                                                PrimitiveTypeKind.Int32, "hour",
                                                                                PrimitiveTypeKind.Int32, "minute",
                                                                                PrimitiveTypeKind.Double, "second");


            //DateTimeOffset constructor
            functions.AddFunction(PrimitiveTypeKind.DateTimeOffset, "CreateDateTimeOffset", PrimitiveTypeKind.Int32, "year",
                                                                                            PrimitiveTypeKind.Int32, "month",
                                                                                            PrimitiveTypeKind.Int32, "day",
                                                                                            PrimitiveTypeKind.Int32, "hour",
                                                                                            PrimitiveTypeKind.Int32, "minute",
                                                                                            PrimitiveTypeKind.Double, "second", 
                                                                                            PrimitiveTypeKind.Int32, "timeZoneOffset");

            //Time constructor
            functions.AddFunction(PrimitiveTypeKind.Time, "CreateTime", PrimitiveTypeKind.Int32, "hour", PrimitiveTypeKind.Int32, "minute", PrimitiveTypeKind.Double, "second");

            //Date and time addition functions
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(type, "AddYears", type, "dateValue", PrimitiveTypeKind.Int32, "addValue"));
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(type, "AddMonths", type, "dateValue", PrimitiveTypeKind.Int32, "addValue"));
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(type, "AddDays", type, "dateValue", PrimitiveTypeKind.Int32, "addValue"));

            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(type, "AddHours", type, "timeValue", PrimitiveTypeKind.Int32, "addValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(type, "AddMinutes", type, "timeValue", PrimitiveTypeKind.Int32, "addValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(type, "AddSeconds", type, "timeValue", PrimitiveTypeKind.Int32, "addValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(type, "AddMilliseconds", type, "timeValue", PrimitiveTypeKind.Int32, "addValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(type, "AddMicroseconds", type, "timeValue", PrimitiveTypeKind.Int32, "addValue"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(type, "AddNanoseconds", type, "timeValue", PrimitiveTypeKind.Int32, "addValue"));
            
            // Date and time diff functions
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffYears", type, "dateValue1", type, "dateValue2"));
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffMonths", type, "dateValue1", type, "dateValue2"));
            functions.ForTypes(dateTimeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffDays", type, "dateValue1", type, "dateValue2"));
            
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffHours", type, "timeValue1", type, "timeValue2"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffMinutes", type, "timeValue1", type, "timeValue2"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffSeconds", type, "timeValue1", type, "timeValue2"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffMilliseconds", type, "timeValue1", type, "timeValue2"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffMicroseconds", type, "timeValue1", type, "timeValue2"));
            functions.ForTypes(timeParameterTypes, type => functions.AddFunction(PrimitiveTypeKind.Int32, "DiffNanoseconds", type, "timeValue1", type, "timeValue2"));
                        
            #endregion // DateTime Functions
            
            #region Math Functions

            // Overloads for ROUND, FLOOR, CEILING functions
            parameterTypes = new[] { PrimitiveTypeKind.Single,
                                     PrimitiveTypeKind.Double,
                                     PrimitiveTypeKind.Decimal };
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "Round", type, "value"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "Floor", type, "value"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "Ceiling", type, "value"));

            // Overloads for ROUND, TRUNCATE
            parameterTypes = new [] { PrimitiveTypeKind.Double,
                                      PrimitiveTypeKind.Decimal };
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "Round", type, "value", PrimitiveTypeKind.Int32, "digits"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "Truncate", type, "value", PrimitiveTypeKind.Int32, "digits"));
            
            // Overloads for ABS functions
            parameterTypes = new[] { PrimitiveTypeKind.Decimal,
                                     PrimitiveTypeKind.Double,
                                     PrimitiveTypeKind.Int16,
                                     PrimitiveTypeKind.Int32,
                                     PrimitiveTypeKind.Int64,
                                     PrimitiveTypeKind.Byte,
                                     PrimitiveTypeKind.Single };
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "Abs", type, "value"));
            
            // Overloads for POWER functions
            PrimitiveTypeKind[] powerFirstParameterTypes = { PrimitiveTypeKind.Decimal,
                                        PrimitiveTypeKind.Double,
                                        PrimitiveTypeKind.Int32,
                                        PrimitiveTypeKind.Int64};

            PrimitiveTypeKind[] powerSecondParameterTypes = { PrimitiveTypeKind.Decimal,
                                        PrimitiveTypeKind.Double,
                                        PrimitiveTypeKind.Int64 };

            foreach (PrimitiveTypeKind kind1 in powerFirstParameterTypes)
            {
                foreach (PrimitiveTypeKind kind2 in powerSecondParameterTypes)
                {
                    functions.AddFunction(kind1, "Power", kind1, "baseArgument", kind2, "exponent");
                }
            }

            #endregion // Math Functions

            #region Bitwise Functions

            // Overloads for BitwiseAND, BitwiseNOT, BitwiseOR, BitwiseXOR functions
            parameterTypes = new[] { PrimitiveTypeKind.Int16,
                                     PrimitiveTypeKind.Int32,
                                     PrimitiveTypeKind.Int64,
                                     PrimitiveTypeKind.Byte };

            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "BitwiseAnd", type, "value1", type, "value2"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "BitwiseOr", type, "value1", type, "value2"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "BitwiseXor", type, "value1", type, "value2"));
            functions.ForTypes(parameterTypes, type => functions.AddFunction(type, "BitwiseNot", type, "value"));
            
            #endregion

            #region Misc Functions

            functions.AddFunction(PrimitiveTypeKind.Guid, "NewGuid");
            
            #endregion // Misc Functions

            #region Spatial Functions

            EdmProviderManifestSpatialFunctions.AddFunctions(functions);

            #endregion

            System.Collections.ObjectModel.ReadOnlyCollection<EdmFunction> readOnlyFunctions = functions.ToFunctionCollection();

            Interlocked.CompareExchange<System.Collections.ObjectModel.ReadOnlyCollection<EdmFunction>>(ref _functions, readOnlyFunctions, null);
        }
        internal static void AddFunctions(EdmProviderManifestFunctionBuilder functions)
        {
            // Geometry Functions
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromText", PrimitiveTypeKind.String, "geometryText");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromText", PrimitiveTypeKind.String, "geometryText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPointFromText", PrimitiveTypeKind.String, "pointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryLineFromText", PrimitiveTypeKind.String, "lineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPolygonFromText", PrimitiveTypeKind.String, "polygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPointFromText", PrimitiveTypeKind.String, "multiPointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiLineFromText", PrimitiveTypeKind.String, "multiLineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPolygonFromText", PrimitiveTypeKind.String, "multiPolygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryCollectionFromText", PrimitiveTypeKind.String, "geometryCollectionText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromBinary", PrimitiveTypeKind.Binary, "geometryBytes");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromBinary", PrimitiveTypeKind.Binary, "geometryBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPointFromBinary", PrimitiveTypeKind.Binary, "pointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryLineFromBinary", PrimitiveTypeKind.Binary, "lineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPolygonFromBinary", PrimitiveTypeKind.Binary, "polygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPointFromBinary", PrimitiveTypeKind.Binary, "multiPointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiLineFromBinary", PrimitiveTypeKind.Binary, "multiLineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPolygonFromBinary", PrimitiveTypeKind.Binary, "multiPolygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryCollectionFromBinary", PrimitiveTypeKind.Binary, "geometryCollectionBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromGml", PrimitiveTypeKind.String, "geometryGml");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromGml", PrimitiveTypeKind.String, "geometryGml", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Int32, "CoordinateSystemId", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.String, "SpatialTypeName", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialDimension", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialEnvelope", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Binary, "AsBinary", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsGml", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsText", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsEmptySpatial", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsSimpleGeometry", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialBoundary", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsValidGeometry", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialEquals", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialDisjoint", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialIntersects", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialTouches", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialCrosses", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialWithin", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialContains", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialOverlaps", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialRelate", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2", PrimitiveTypeKind.String, "matrix");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialBuffer", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Double, "distance");
            functions.AddFunction(PrimitiveTypeKind.Double, "Distance", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialConvexHull", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialIntersection", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialUnion", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialDifference", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialSymmetricDifference", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialElementCount", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialElementAt", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "XCoordinate", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "YCoordinate", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Elevation", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Measure", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "SpatialLength", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "StartPoint", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "EndPoint", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsClosedSpatial", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsRing", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "PointCount", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "PointAt", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Area", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "Centroid", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "PointOnSurface", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "ExteriorRing", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "InteriorRingCount", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "InteriorRingAt", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Int32, "nValue");

            // Geography Functions
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromText", PrimitiveTypeKind.String, "geographyText");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromText", PrimitiveTypeKind.String, "geographyText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPointFromText", PrimitiveTypeKind.String, "pointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyLineFromText", PrimitiveTypeKind.String, "lineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPolygonFromText", PrimitiveTypeKind.String, "polygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPointFromText", PrimitiveTypeKind.String, "multiPointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiLineFromText", PrimitiveTypeKind.String, "multiLineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPolygonFromText", PrimitiveTypeKind.String, "multiPolygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyCollectionFromText", PrimitiveTypeKind.String, "geographyCollectionText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromBinary", PrimitiveTypeKind.Binary, "geographyBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromBinary", PrimitiveTypeKind.Binary, "geographyBytes");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPointFromBinary", PrimitiveTypeKind.Binary, "pointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyLineFromBinary", PrimitiveTypeKind.Binary, "lineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPolygonFromBinary", PrimitiveTypeKind.Binary, "polygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPointFromBinary", PrimitiveTypeKind.Binary, "multiPointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiLineFromBinary", PrimitiveTypeKind.Binary, "multiLineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPolygonFromBinary", PrimitiveTypeKind.Binary, "multiPolygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyCollectionFromBinary", PrimitiveTypeKind.Binary, "geographyCollectionBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromGml", PrimitiveTypeKind.String, "geographyGml");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromGml", PrimitiveTypeKind.String, "geographyGml", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Int32, "CoordinateSystemId", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.String, "SpatialTypeName", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialDimension", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Binary, "AsBinary", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsGml", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsText", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsEmptySpatial", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialEquals", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialDisjoint", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialIntersects", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialBuffer", PrimitiveTypeKind.Geography, "geographyValue", PrimitiveTypeKind.Double, "distance");
            functions.AddFunction(PrimitiveTypeKind.Double, "Distance", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialIntersection", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialUnion", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialDifference", PrimitiveTypeKind.Geography, "geometryValue1", PrimitiveTypeKind.Geography, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialSymmetricDifference", PrimitiveTypeKind.Geography, "geometryValue1", PrimitiveTypeKind.Geography, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialElementCount", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialElementAt", PrimitiveTypeKind.Geography, "geographyValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Latitude", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Longitude", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Elevation", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Measure", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "SpatialLength", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "StartPoint", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "EndPoint", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsClosedSpatial", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "PointCount", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "PointAt", PrimitiveTypeKind.Geography, "geographyValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Area", PrimitiveTypeKind.Geography, "geographyValue");

        }
        internal static void AddFunctions(EdmProviderManifestFunctionBuilder functions)
        {
            // Geometry Functions
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromText", PrimitiveTypeKind.String, "geometryText");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromText", PrimitiveTypeKind.String, "geometryText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPointFromText", PrimitiveTypeKind.String, "pointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryLineFromText", PrimitiveTypeKind.String, "lineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPolygonFromText", PrimitiveTypeKind.String, "polygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPointFromText", PrimitiveTypeKind.String, "multiPointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiLineFromText", PrimitiveTypeKind.String, "multiLineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPolygonFromText", PrimitiveTypeKind.String, "multiPolygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryCollectionFromText", PrimitiveTypeKind.String, "geometryCollectionText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromBinary", PrimitiveTypeKind.Binary, "geometryBytes");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromBinary", PrimitiveTypeKind.Binary, "geometryBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPointFromBinary", PrimitiveTypeKind.Binary, "pointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryLineFromBinary", PrimitiveTypeKind.Binary, "lineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryPolygonFromBinary", PrimitiveTypeKind.Binary, "polygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPointFromBinary", PrimitiveTypeKind.Binary, "multiPointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiLineFromBinary", PrimitiveTypeKind.Binary, "multiLineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryMultiPolygonFromBinary", PrimitiveTypeKind.Binary, "multiPolygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryCollectionFromBinary", PrimitiveTypeKind.Binary, "geometryCollectionBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromGml", PrimitiveTypeKind.String, "geometryGml");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "GeometryFromGml", PrimitiveTypeKind.String, "geometryGml", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Int32, "CoordinateSystemId", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.String, "SpatialTypeName", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialDimension", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialEnvelope", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Binary, "AsBinary", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsGml", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsText", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsEmptySpatial", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsSimpleGeometry", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialBoundary", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsValidGeometry", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialEquals", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialDisjoint", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialIntersects", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialTouches", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialCrosses", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialWithin", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialContains", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialOverlaps", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialRelate", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2", PrimitiveTypeKind.String, "matrix");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialBuffer", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Double, "distance");
            functions.AddFunction(PrimitiveTypeKind.Double, "Distance", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialConvexHull", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialIntersection", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialUnion", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialDifference", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialSymmetricDifference", PrimitiveTypeKind.Geometry, "geometryValue1", PrimitiveTypeKind.Geometry, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialElementCount", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "SpatialElementAt", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "XCoordinate", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "YCoordinate", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Elevation", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Measure", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "SpatialLength", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "StartPoint", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "EndPoint", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsClosedSpatial", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsRing", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "PointCount", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "PointAt", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Area", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "Centroid", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "PointOnSurface", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "ExteriorRing", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "InteriorRingCount", PrimitiveTypeKind.Geometry, "geometryValue");
            functions.AddFunction(PrimitiveTypeKind.Geometry, "InteriorRingAt", PrimitiveTypeKind.Geometry, "geometryValue", PrimitiveTypeKind.Int32, "nValue");

            // Geography Functions
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromText", PrimitiveTypeKind.String, "geographyText");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromText", PrimitiveTypeKind.String, "geographyText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPointFromText", PrimitiveTypeKind.String, "pointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyLineFromText", PrimitiveTypeKind.String, "lineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPolygonFromText", PrimitiveTypeKind.String, "polygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPointFromText", PrimitiveTypeKind.String, "multiPointText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiLineFromText", PrimitiveTypeKind.String, "multiLineText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPolygonFromText", PrimitiveTypeKind.String, "multiPolygonText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyCollectionFromText", PrimitiveTypeKind.String, "geographyCollectionText", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromBinary", PrimitiveTypeKind.Binary, "geographyBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromBinary", PrimitiveTypeKind.Binary, "geographyBytes");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPointFromBinary", PrimitiveTypeKind.Binary, "pointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyLineFromBinary", PrimitiveTypeKind.Binary, "lineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyPolygonFromBinary", PrimitiveTypeKind.Binary, "polygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPointFromBinary", PrimitiveTypeKind.Binary, "multiPointBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiLineFromBinary", PrimitiveTypeKind.Binary, "multiLineBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyMultiPolygonFromBinary", PrimitiveTypeKind.Binary, "multiPolygonBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyCollectionFromBinary", PrimitiveTypeKind.Binary, "geographyCollectionBytes", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromGml", PrimitiveTypeKind.String, "geographyGml");
            functions.AddFunction(PrimitiveTypeKind.Geography, "GeographyFromGml", PrimitiveTypeKind.String, "geographyGml", PrimitiveTypeKind.Int32, "srid");
            functions.AddFunction(PrimitiveTypeKind.Int32, "CoordinateSystemId", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.String, "SpatialTypeName", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialDimension", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Binary, "AsBinary", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsGml", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.String, "AsText", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsEmptySpatial", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialEquals", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialDisjoint", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "SpatialIntersects", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialBuffer", PrimitiveTypeKind.Geography, "geographyValue", PrimitiveTypeKind.Double, "distance");
            functions.AddFunction(PrimitiveTypeKind.Double, "Distance", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialIntersection", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialUnion", PrimitiveTypeKind.Geography, "geographyValue1", PrimitiveTypeKind.Geography, "geographyValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialDifference", PrimitiveTypeKind.Geography, "geometryValue1", PrimitiveTypeKind.Geography, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialSymmetricDifference", PrimitiveTypeKind.Geography, "geometryValue1", PrimitiveTypeKind.Geography, "geometryValue2");
            functions.AddFunction(PrimitiveTypeKind.Int32, "SpatialElementCount", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "SpatialElementAt", PrimitiveTypeKind.Geography, "geographyValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Latitude", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Longitude", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Elevation", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Measure", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "SpatialLength", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "StartPoint", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "EndPoint", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Boolean, "IsClosedSpatial", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Int32, "PointCount", PrimitiveTypeKind.Geography, "geographyValue");
            functions.AddFunction(PrimitiveTypeKind.Geography, "PointAt", PrimitiveTypeKind.Geography, "geographyValue", PrimitiveTypeKind.Int32, "nValue");
            functions.AddFunction(PrimitiveTypeKind.Double, "Area", PrimitiveTypeKind.Geography, "geographyValue");
        }