本文整理汇总了C#中Entities.DeleteObject方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.DeleteObject方法的具体用法?C# Entities.DeleteObject怎么用?C# Entities.DeleteObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.DeleteObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: rptList_ItemCommand
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);
Entities bll = new Entities();
L_Form model = bll.L_Form.First(p => p.FID == id);
switch (e.CommandName.ToLower())
{
case "del":
bll.DeleteObject(model);
break;
}
bll.SaveChanges();
grdbind();
//RptBind("Id>0" + CombSqlTxt(this.kindId, this.classId, this.keywords, this.property), "AddTime desc");
}
示例2: rptList_ItemCommand
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);
Entities bll = new Entities();
L_Log model = bll.L_Log.First(p => p.LID == id);
switch (e.CommandName.ToLower())
{
case "del":
bll.DeleteObject(model);
break;
}
bll.SaveChanges();
grdbind();
}
示例3: DeleteAll
public static bool DeleteAll()
{
using (var context = new Entities())
{
try
{
var raceintermediates = context.RaceIntermediates;
foreach (var raceintermediate in raceintermediates)
{
context.DeleteObject(raceintermediate);
}
var runtimes = context.Runtimes;
foreach (var runtime in runtimes)
{
context.DeleteObject(runtime);
}
var raceathletes = context.RaceAthletes;
foreach (var raceathlete in raceathletes)
{
context.DeleteObject(raceathlete);
}
var athletes = context.Athletes;
foreach (var athlete in athletes)
{
context.DeleteObject(athlete);
}
var classes = context.AthleteClasses;
foreach (var athleteClass in classes)
{
context.DeleteObject(athleteClass);
}
var orders = context.CheckpointOrders;
foreach (var order in orders)
{
context.DeleteObject(order);
}
var checkpoints = context.Checkpoints;
foreach (var checkpoint in checkpoints)
{
context.DeleteObject(checkpoint);
}
var clubs = context.Clubs;
foreach (var club in clubs)
{
context.DeleteObject(club);
}
var timers = context.Timers;
foreach (var time in timers)
{
context.DeleteObject(time);
}
var races = context.Races;
foreach (var race in races)
{
context.DeleteObject(race);
}
var evnts = context.Events;
foreach (var evnt in evnts)
{
context.DeleteObject(evnt);
}
context.SaveChanges();
return true;
}
catch (System.Exception)
{
return false;
}
}
}