Azavea.Open.DAO.PostgreSQL.PostgreSqlDaLayer.PreProcessPropertyValues C# (CSharp) Method

PreProcessPropertyValues() protected method

Overriden to convert IGeometries to correctly-encoded strings that PostGIS can recognize. This is called prior to inserting or updating these values in the table.
protected PreProcessPropertyValues ( string table, object>.IDictionary propValues ) : void
table string The table these values will be inserted or updated into.
propValues object>.IDictionary A dictionary of "column"/value pairs for the object to insert or update.
return void
        protected override void PreProcessPropertyValues(string table,
            IDictionary<string, object> propValues)
        {
            // Look for objects being saved that are IGeometries.
            IDictionary<string, object> propsToModify = new Dictionary<string, object>();
            foreach (string propName in propValues.Keys)
            {
                if (propValues[propName] is IGeometry)
                {
                    IGeometry theGeom = (IGeometry)propValues[propName];
                    propsToModify.Add(propName, _ewktWriter.Write(theGeom));
                }
            }
            foreach (string propName in propsToModify.Keys)
            {
                propValues[propName] = propsToModify[propName];
            }
        }