{
if (id > 0)
{
using (var session = NHibernateHelper.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
var pid = session.Get<FSPID>(id);
var dictionaryList = session.Query<FSDictionary>()
.Where(x => x.PIDId == id)
.Select(x => x.Id)
.ToList();
session.CreateQuery("DELETE From FSFileInfoDictionary WHERE DictionaryId in (:id)")
.SetParameterList("id", dictionaryList)
.ExecuteUpdate();
session.CreateQuery("DELETE From FSDictionary WHERE PIDId = :id")
.SetParameter("id", id)
.ExecuteUpdate();
var regexList = session.Query<FSRegex>().Where(x => x.PIDId == id).Select(x => x.Id).ToList();
session.CreateQuery("DELETE From FSFileInfoRegex WHERE RegexID in (:id)")
.SetParameterList("id", regexList)
.ExecuteUpdate();
session.CreateQuery("DELETE From FSRegex WHERE PIDId = :id")
.SetParameter("id", id)
.ExecuteUpdate();
session.Delete(pid);
session.Flush();
transaction.Commit();
}
}
}
return Redirect("~/Admin/PIDSettings");
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.