private DictionaryScope CreateDictionaryScope(IDatabaseStaticTextContext dbContext, string dictionaryScopeName) { var dsDao = new DictionaryScopeDao(dbContext.DictionaryScope); return(dsDao.Create(new DictionaryScope() { Name = dictionaryScopeName })); }
public LocalizedString DatabaseTranslateFormat(string text, object[] parameters, CultureInfo cultureInfo, string scope) { using (var dbContext = m_dbContextFunc.Invoke()) { var cultureDao = new CultureDao(dbContext.Culture); var culture = cultureDao.FindByName(cultureInfo.Name); var dictionaryScopeDao = new DictionaryScopeDao(dbContext.DictionaryScope); var dictionaryScope = dictionaryScopeDao.FindByName(scope); var staticTextDao = new StaticTextDao(dbContext.StaticText); IStaticText dbResult = staticTextDao.FindByNameAndCultureAndScope(text, culture, dictionaryScope, dbContext.CultureHierarchy); return(new LocalizedString(text, dbResult.Text, false)); } }
protected DictionaryScope GetDictionaryScope(IDatabaseStaticTextContext dbContext, string scopeName) { var dictionaryScopeDao = new DictionaryScopeDao(dbContext.DictionaryScope); var resultDictionaryScope = dictionaryScopeDao.FindByName(scopeName); if (resultDictionaryScope == null) { resultDictionaryScope = dictionaryScopeDao.FindByName(m_configuration.DefaultScope); } if (resultDictionaryScope == null) { if (m_logger.IsErrorEnabled()) { m_logger.LogError(@"Default dictionary scope ""{0}"" from library configuration is not in database.", m_configuration.DefaultScope); } } return(resultDictionaryScope); }