/// <summary> /// Inserts a <see cref="Geometry"/> into the current table as a new record. /// </summary> /// <param name="obj">The object to be inserted.</param> public void Insert(Geometry obj) { MappableEntity mappable = new MappableEntity(); mappable.obj = obj; this.Insert(mappable); }
private MapNode PlaceAtSingle(MappableEntity content, int x, int y) { var node = _mapNodes[x, y]; node.AddContent(content); return(node); }
public void GenerateInsertStringCanHandleGeometryObjects() { SqlStringGenerator gen = new SqlStringGenerator(); MappableEntity entity = new MappableEntity(); entity.obj = new Line(); string updatestring = gen.GenerateInsertString(entity, "DummyTable"); string expected = "INSERT INTO DummyTable (obj) VALUES (CreateLine(0,0,0,0))"; Assert.AreEqual(expected, updatestring); }
public void GenerateInsertStringCanHandleGeometryObjects( [Values("DummyVar", "DummyTable.Obj")] string variableName) { Mock <IGeometry> mockobj = new Mock <IGeometry>(); mockobj.Setup(obj => obj.Variable.GetExpression()) .Returns(variableName); SqlStringGenerator gen = new SqlStringGenerator(); MappableEntity entity = new MappableEntity(); entity.obj = mockobj.Object; string updatestring = gen.GenerateInsertString(entity, "DummyTable"); string expected = "INSERT INTO DummyTable (obj) VALUES ({0})".FormatWith(variableName); Assert.AreEqual(expected, updatestring); }
public List <MapNode> PlaceAt(MappableEntity content, int xPlace, int yPlace, int xSize = 1, int ySize = 1) { List <MapNode> nodes = new List <MapNode>(); try { if (xSize > 1 || ySize > 1) { var xMin = xPlace; var xMax = xPlace + xSize; var yMin = yPlace; var yMax = yPlace + ySize; for (int x = xMin; x < xMax; x++) { for (int y = yMin; y < yMax; y++) { var node = this.PlaceAtSingle(content, x, y); nodes.Add(node); } } } else { var node = this.PlaceAtSingle(content, xPlace, yPlace); nodes.Add(node); } } catch { //TODO: Make this a part of the Entity Out of Bounds framework throw; } return(nodes); }
public TTarget MapTo <TTarget>(MappableEntity source) where TTarget : MappableDTO, new() { return(MapTo(source, targetType: typeof(TTarget)) as TTarget); }