示例#1
0
 void Save(ShapeModel shape)
 {
     using (ShapeDBContext db = new ShapeDBContext())
     {
         db.Shapes.Add(shape);
         db.SaveChanges();
     }
 }
示例#2
0
 ShapeModel Last()
 {
     ShapeModel shape = new ShapeModel {};
     using (ShapeDBContext db = new ShapeDBContext())
     {
         if (db.Shapes.Count() > 0)
             shape = db.Shapes.ToList().Last<ShapeModel>();
     }
     return shape;
 }