Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Last active December 17, 2015 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhameyie/5666712 to your computer and use it in GitHub Desktop.
Save bhameyie/5666712 to your computer and use it in GitHub Desktop.
Simple.data sample inserts & delete
//Inserting a story
var database = Database.OpenConnection(m_connectionString);
var result = database.Stories.Insert(entity); //This doesn’t save the Project or Tasks associated with the story. The result being return is the saved object with an updated Id.
//updating
var inserted = database.Stories.Update(entity);
//sample update all
database.Stories.UpdateAll(Title: "Glorious");
database.Stories.UpdateAll(database.Stories.Estimate > 10, Title: “Break me down into multiple smaller stories");
//Deleting
database.Stories.DeleteAll(database.Stories.Estimate > 50);
database.Stories.DeleteById(id);
//I’m a baller. I don’t need stories
database.Stories.DeleteAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment