title: What is the right way to insert DBGeography type via ado.net
body: <p>I am trying to insert <code>DBGeography</code> type via ado.net but no luck.<br/>
  This is the errors that I am getting:</p>
  
  <blockquote>
    <p>No mapping exists from object type
    System.Data.Entity.Spatial.DbGeography to a known managed provider
    native type.</p>
  </blockquote>
  
  <p>or:</p>
  
  <blockquote>
    <p>Specified type is not registered on the target
    server.System.Data.Entity.Spatial.DbGeography, EntityFramework,
    Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.</p>
  </blockquote>
  
  <p>This is what I do when I am getting it from db and this works fine:</p>
  
  <pre><code>dynamic temp = reader.GetValue(3);
  
                  var text = string.Format("POINT({0:R} {1:R})", temp.Long, temp.Lat);
                  var srid = temp.STSrid.Value;
                  this.Coordinates = System.Data.Entity.Spatial.DbGeography.PointFromText(text, srid);
  </code></pre>
  
  <p>But insert doesn't work:</p>
  
  <pre><code>updateCommand.Parameters.AddWithValue("@Coordinates", store.Coordinates);
  // or ...
  SqlParameter p = new SqlParameter();
                      p.ParameterName = "@Coordinates";
                      p.Value = store.Coordinates;
                      p.SqlDbType = System.Data.SqlDbType.Udt;
                      p.UdtTypeName = "geography";
                      updateCommand.Parameters.Add(p);
  </code></pre>
  
  <p>What is wrong here?</p>