Check out https://docs.abp.io/en/abp/latest/Object-Extensions
In this document an extra field SocialSecurityNumber is being added to IdentityUser entity.
Hi,
Use the below service to fetch the texts, Now you can fetch without any permission.
public class MyLanguageAppService : LanguageAppServiceBase, IApplicationService
{
protected ILanguageTextRepository LanguageTextRepository { get; }
protected IStringLocalizerFactory LocalizerFactory { get; }
protected AbpLocalizationOptions AbpLocalizationOptions { get; }
public MyLanguageAppService(
ILanguageTextRepository languageTextRepository,
IOptions<AbpLocalizationOptions> abpLocalizationOptions,
IStringLocalizerFactory localizerFactory)
{
LanguageTextRepository = languageTextRepository;
LocalizerFactory = localizerFactory;
AbpLocalizationOptions = abpLocalizationOptions.Value;
}
public Task<PagedResultDto<LanguageTextDto>> GetListAsync(GetLanguagesTextsInput input)
{
var languageTexts = new List<LanguageTextDto>();
foreach (var resourceName in GetResourceNames(input))
{
languageTexts.AddRange(GetLocalizationsFromResource(input, resourceName));
}
var filteredQuery = languageTexts
.AsQueryable()
.WhereIf(
!input.Filter.IsNullOrWhiteSpace(),
l =>
(l.Name != null && l.Name.IndexOf(input.Filter, StringComparison.OrdinalIgnoreCase) >= 0) ||
(l.BaseValue != null && l.BaseValue.IndexOf(input.Filter, StringComparison.OrdinalIgnoreCase) >= 0) ||
(!input.GetOnlyEmptyValues && l.Value != null && l.Value.IndexOf(input.Filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
);
var languagesTextDtos = filteredQuery
.OrderBy(input.Sorting ?? $"{nameof(LanguageTextDto.Name)} ASC")
.PageBy(input)
.ToList();
return Task.FromResult(new PagedResultDto<LanguageTextDto>(
filteredQuery.Count(),
languagesTextDtos
));
}
protected List<string> GetResourceNames(GetLanguagesTextsInput input)
{
var resourceNames = new List<string>();
if (string.IsNullOrWhiteSpace(input.ResourceName))
{
resourceNames.AddRange(
AbpLocalizationOptions
.Resources
.Values
.Select(l => l.ResourceName)
);
}
else
{
resourceNames.Add(input.ResourceName);
}
return resourceNames;
}
protected virtual List<LanguageTextDto> GetLocalizationsFromResource(
GetLanguagesTextsInput input,
string resourceName)
{
var localizer = GetLocalizer(resourceName);
List<LocalizedString> baseLocalizedStrings;
List<LocalizedString> targetLocalizedStrings;
using (CultureHelper.Use(CultureInfo.GetCultureInfo(input.BaseCultureName)))
{
baseLocalizedStrings = localizer
.GetAllStrings(includeParentCultures: true, includeBaseLocalizers: false)
.ToList();
}
using (CultureHelper.Use(CultureInfo.GetCultureInfo(input.TargetCultureName)))
{
targetLocalizedStrings = localizer
.GetAllStrings(includeParentCultures: false, includeBaseLocalizers: false)
.ToList();
}
var languageTextDtos = new List<LanguageTextDto>();
foreach (var baseLocalizedString in baseLocalizedStrings)
{
var target = targetLocalizedStrings.FirstOrDefault(l => l.Name == baseLocalizedString.Name);
if (input.GetOnlyEmptyValues)
{
if (!string.IsNullOrEmpty(target?.Value))
{
continue;
}
}
languageTextDtos.Add(
new LanguageTextDto
{
BaseCultureName = input.BaseCultureName,
CultureName = input.TargetCultureName,
Name = baseLocalizedString.Name,
BaseValue = baseLocalizedString.Value,
ResourceName = resourceName,
Value = target?.Value ?? ""
}
);
}
return languageTextDtos;
}
protected IStringLocalizer GetLocalizer(LocalizationResource resource)
{
return LocalizerFactory.Create(resource.ResourceType);
}
protected IStringLocalizer GetLocalizer(string recourseName)
{
return GetLocalizer(GetLocalizationResource(recourseName));
}
protected LocalizationResource GetLocalizationResource(string resourceName)
{
var resource = AbpLocalizationOptions.Resources
.Values
.FirstOrDefault(r => r.ResourceName == resourceName);
if (resource == null)
{
throw new AbpException($"Resource not found: {resourceName}");
}
return resource;
}
}
@pvaz can you share the GitHub link of the comment that solves in RC-4.1
good! so update it to 3.3.2 I'm closing the issue. reopen if it continues... happy coding.
good to hear that. closing the issue
robb@designitcorp.ca
it doesn't matter where the solution is located.
the entites must be inside the root folder of the solution (in .suite/entities folder)
can you send us the project? info@abp.io
@pvaz if you upgraded from 3X to 4X see this post https://docs.abp.io/en/abp/4.0/Migration-Guides/Abp-4_0 also check out https://github.com/abpframework/abp/issues/5950#issue-729718680
robb@designitcorp.ca check out https://support.abp.io/QA/Questions/625/How-to-include-Suite-entities-in-my-source-control-system#answer-1287c0f9-c787-9953-f091-39f9374847bc
This feature is implemented in v4.0.0 RC.5 and the release of RC5 is 2020-12-04.
Starting from v4.0, your entities will be located in the .suite folder in your solution's root directory.
On the other hand to keep the same behaviour for the old projects, it still saves it in the existing directory => %UserProfile%\.abp\suite\solutions\{solution-id}\entities\
if you want your Suite entities to be included in your Git system, follow the steps:
.suite in your root directory.%UserProfile%\.abp\suite\solutions\{solution-id}\entities\ folder to the new folder .suite/entitiesentities folder (mandatory) => %UserProfile%\.abp\suite\solutions\{solution-id}\entities