コード例 #1
0
        public virtual void InstallLanguageResource(string resourceFolder)
        {
            var languageResources =
                XDocument.Load(Path.Combine(resourceFolder, LanguageResourcesXml)).Descendants(LocalResourceElementName);

            languageResources.ForEachItem(lsr =>
            {
                var localeStringResource = new LocaleStringResource
                {
                    ResourceName = lsr.Attribute("Name").Value,
                    ResourceValue = lsr.Attribute("Value").Value
                };
                AddOrUpdateLocaleStringResource(localeStringResource);
            });
        }
コード例 #2
0
        protected virtual void AddOrUpdateLocaleStringResource(LocaleStringResource localeStringResource)
        {

            var query = _localeStringResourceRepository.Table.Where(
                l => l.ResourceName.Equals(localeStringResource.ResourceName, StringComparison.OrdinalIgnoreCase))
                .OrderBy(x => x.Id);
                var lsr = query.FirstOrDefault();
            if(lsr.IsNull())
                _localeStringResourceRepository.Insert(localeStringResource);
            else
            {
                lsr.ResourceValue = localeStringResource.ResourceValue;
                _localeStringResourceRepository.Update(lsr);
                _eventPublisher.EntityUpdated(lsr);
            }
        }