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?
精彩评论