当前位置: 首页>>代码示例>>C#>>正文


C# Entities.DeleteObject方法代码示例

本文整理汇总了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");
    }
开发者ID:priceLiu,项目名称:CMS,代码行数:17,代码来源:List.aspx.cs

示例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();
    }
开发者ID:priceLiu,项目名称:CMS,代码行数:18,代码来源:LogList.aspx.cs

示例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;
                }
            }
        }
开发者ID:heinek,项目名称:ITimeU,代码行数:71,代码来源:DBAdminModel.cs


注:本文中的Entities.DeleteObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。