public void Can_insert_and_update_SqlGeography() { Db.DropAndCreateTable <ModelWithSqlGeography>(); var wkt = "POINT(38.028495788574205 55.895460650576936)"; var geo = SqlGeography.STGeomFromText(new System.Data.SqlTypes.SqlChars(wkt), 4326); var obj = new ModelWithSqlGeography { Name = "Test", Created = DateTime.UtcNow, Geo = geo }; var id = (int)Db.Insert(obj, selectIdentity: true); obj.ID = id; try { // Update of POCO with SqlGeography proprety should work obj.Name = "Test - modified"; obj.Edited = DateTime.UtcNow; Db.Update(obj); } catch (Exception ex) { Assert.Fail(ex.ToString()); } finally { // GetLastSql shouldn't return null after exception var lastSql = Db.GetLastSql(); Assert.IsNotNull(lastSql); } }
public void Can_insert_and_update_SqlGeography() { Db.DropAndCreateTable<ModelWithSqlGeography>(); var wkt = "POINT(38.028495788574205 55.895460650576936)"; var geo = SqlGeography.STGeomFromText(new System.Data.SqlTypes.SqlChars(wkt), 4326); var obj = new ModelWithSqlGeography { Name = "Test", Created = DateTime.UtcNow, Geo = geo }; var id = (int)Db.Insert(obj, selectIdentity: true); obj.ID = id; try { // Update of POCO with SqlGeography proprety should work obj.Name = "Test - modified"; obj.Edited = DateTime.UtcNow; Db.Update(obj); } catch (Exception ex) { Assert.Fail(ex.ToString()); } finally { // GetLastSql shouldn't return null after exception var lastSql = Db.GetLastSql(); Assert.IsNotNull(lastSql); } }