本文整理汇总了C#中IPersistenceContext.BeginTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# IPersistenceContext.BeginTransaction方法的具体用法?C# IPersistenceContext.BeginTransaction怎么用?C# IPersistenceContext.BeginTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPersistenceContext
的用法示例。
在下文中一共展示了IPersistenceContext.BeginTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WebSferaService
public WebSferaService()
{
_persistenceContext = _container.Resolve<IPersistenceContext>();
_persistenceContext.BeginTransaction(Security.Login.Instance.CurrentLogin().LoginName, System.Data.IsolationLevel.Unspecified);
var parameters = new Dictionary<string,object>(1) {{"deleted", "Y"}};
_persistenceContext.EnableFilter("excludeDeletedCondominio", parameters);
_persistenceContext.EnableFilter("excludeDeletedUnitaImmobiliari", parameters);
var parametersRate = new Dictionary<string, object>(1) {{"stato", StatoRataEnum.Richiamata.ToString()}};
_persistenceContext.EnableFilter("excludeRateRichiamate", parametersRate);
}
示例2: BeginTransaction
public LogTransazione BeginTransaction(UserInfo info, System.Data.IsolationLevel isolationLevel, bool isTransazioneLog = false, bool? flushOnCommit = null)
{
try
{
var daoFactory = GetDaoFactory(info.Azienda);
var utenti = daoFactory.GetUtenteDao().GetByAzienda(info.Azienda);
_container = GetContainer(info.Azienda);
_persistenceContext = _container.Resolve<IPersistenceContext>();
var singleOrDefault = utenti.SingleOrDefault(item => item.ID == info.Utente);
if (singleOrDefault != null)
_utente = singleOrDefault.Referente != null ? singleOrDefault.Referente.PersonaRiferimento.Nome : singleOrDefault.Nome;
_persistenceContext.BeginTransaction(_utente, isolationLevel, flushOnCommit);
var parameters = new Dictionary<string, object>(1) {{"deleted", "Y"}};
_persistenceContext.EnableFilter("excludeDeletedCondominio", parameters);
_persistenceContext.EnableFilter("excludeDeletedUnitaImmobiliari", parameters);
_persistenceContext.EnableFilter("excludeDeletedSottoconto", parameters);
var parametersRate = new Dictionary<string, object>(1) {{"stato", StatoRataEnum.Richiamata.ToString()}};
_persistenceContext.EnableFilter("excludeRateRichiamate", parametersRate);
LogTransazione logTransazione = null;
if (isTransazioneLog)
{
_logTransazioneService = _container.Resolve<ILogTransazioneService>();
logTransazione = _logTransazioneService.AddLog(info.Utente, AzioneUtente.TransazioneContabile);
}
return logTransazione;
}
catch (Exception ex)
{
var log = LogManager.GetLogger("Sfera");
log.FatalFormat("Errore durante la inizializzazione della transazione - {0} - idAzienda:{1} - utente:{2}", ex, Library.Utility.GetMethodDescription(), info.Azienda, info.Utente);
throw;
}
}