コード例 #1
0
        public void Insert()
        {
            using (var uow = _unitOfWorkFactory.Create())
            {
                var defaultLanguage = DefaultLanguage;
                uow.GetRepository.Add(defaultLanguage);

                foreach (var item in GetResourceString())
                {
                    var localeResourceKey = new LocaleResourceKey
                    {
                        Id = Guid.NewGuid(),
                        Key = item.Key
                    };
                    uow.GetRepository.Add(localeResourceKey);

                    var localeResource = new LocaleResource
                    {
                        Id = Guid.NewGuid(),
                        Value = item.Value,
                        LanguageId = defaultLanguage.Id,
                        LocaleResourceKeyId = localeResourceKey.Id
                    };
                    uow.GetRepository.Add(localeResource);
                }

                uow.Commit();
            }
        }
コード例 #2
0
        private LocaleResource CreateLocaleResource()
        {
            var localeResourceKeyId = Guid.NewGuid();

            var result = new LocaleResource
            {
                Id = Guid.NewGuid(),
                LocaleResourceKey = new LocaleResourceKey
                {
                    Id = localeResourceKeyId
                },
                LocaleResourceKeyId = localeResourceKeyId
            };

            return result;
        }
コード例 #3
0
 public LocaleResourcesUpdateViewModel(LocaleResource localeResource)
 {
     LanguageId = localeResource.LanguageId.Value;
     LocaleResourceKey = localeResource.LocaleResourceKey.Key;
     Value = localeResource.Value;
 }