开发者

Can I write process statement in LINQ?

I am wondering if I can write process statement in a LINQ To SQL update method.

data tier:

public Boolean Update(int userId,string version, Action<Application> callback)
{
    using (var dc = new VettingDataContext(_connString))
    {
        var entity = (from a in dc.Applications
                      where a.UserId == userId && a.chr_Version==version
                     select a).First();
        callback(entity);
        try
        {
            dc.SubmitChanges();
            return true;
        }
        catch (Exception)
        {
            return false;
        }
    }
}

domain tier:

ApplicationDAL dal = new ApplicationDAL();
dal.Update(userId, "mf001", info =>
{
     if(...){
      .....
     }else{
     ....
     }

 info.id=Convert.ToInt32(tb_id.Text);
});

I'm not sure if those process statemen开发者_运维技巧ts (if..else, and data convert function) work.


Should be ok

Did you try it? What is the real question?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜