本文整理汇总了C#中PetaPoco.Database.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# PetaPoco.Database.Delete方法的具体用法?C# PetaPoco.Database.Delete怎么用?C# PetaPoco.Database.Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PetaPoco.Database
的用法示例。
在下文中一共展示了PetaPoco.Database.Delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Crud
private static void Crud()
{
var petaPoco = new PetaPoco.Database("Chinook");
var customer = new Customer { FirstName = "Ian", LastName = "Russell", Email = "[email protected]" };
petaPoco.Insert(customer);
var id = customer.CustomerId;
customer = petaPoco.Single<Customer>(id);
ObjectDumper.Write(customer);
customer.Country = "United Kingdom";
petaPoco.Update(customer);
customer = petaPoco.Single<Customer>(id);
ObjectDumper.Write(customer);
petaPoco.Delete<Customer>(id);
customer = petaPoco.SingleOrDefault<Customer>(id);
ObjectDumper.Write(customer);
}
示例2: DeleteForum
public static void DeleteForum(int id)
{
using (PetaPoco.Database db = new PetaPoco.Database("sqlconnection"))
{
db.Delete<Models.Forums>("WHERE [email protected]", id);
}
}
示例3: Delete
public ActionResult Delete(int id, string confirmButton)
{
try
{
var db = new PetaPoco.Database("MissNancy");
db.Delete("tblClasses", "ClassKey", null, id);
return RedirectToAction("Index");
}
catch
{
return View();
}
}
示例4: Delete100Test
private static int Delete100Test(string connectionString)
{
var db = new PetaPoco.Database(connectionString, "System.Data.SqlClient");
var homes = db.Query<Home>("SELECT * FROM home WHERE [email protected]", 2015).ToList();
int count = homes.Count();
foreach (var home in homes)
{
if (home != null)
{
home.BuildYear = 2015;
db.Delete("Home", "Id", home);
}
}
return count;
}
示例5: Delete
public int Delete(HistoryEntry entry)
{
Debug.Assert(TableExists(SqlTable.WuHistory));
using (var connection = new SQLiteConnection(ConnectionString))
{
connection.Open();
using (var database = new PetaPoco.Database(connection))
{
return database.Delete(entry);
}
}
}
示例6: DELETE
public object DELETE(int id) {
var db = new PetaPoco.Database("jlapc");
db.Delete("Novedad", "NovedadID", null, id);
JsonResult rta = new JsonResult() { Data = new { ok = true }, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
return rta.Data;
}
示例7: button4_Click
private void button4_Click(object sender, EventArgs e)
{
try
{
// Create a PetaPoco database object
var db = new PetaPoco.Database("sqlite");
// find the (presumably) most recently created foo
int id = db.ExecuteScalar<int>("SELECT max(id) from foo");
// Delete it
db.Delete("foo", "Id", null, id);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
this.fooQuery1.Refresh();
}