Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add persian translate file #450

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
76 changes: 76 additions & 0 deletions src/Application/Exceptions/EntityNotFoundException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Runtime.Serialization;

namespace BlazorHero.CleanArchitecture.Application.Exceptions
{
[Serializable]
public class EntityNotFoundException : Exception
{
/// <summary>
/// Type of the entity.
/// </summary>
public Type EntityType { get; set; }

/// <summary>
/// Id of the Entity.
/// </summary>
public object Id { get; set; }

/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException()
{

}

/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException(SerializationInfo serializationInfo, StreamingContext context)
: base(serializationInfo, context)
{

}

/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException(Type entityType, object id)
: this(entityType, id, null)
{

}

/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException(Type entityType, object id, Exception innerException)
: base($"There is no such an entity. Entity type: {entityType.FullName}, id: {id}", innerException)
{
EntityType = entityType;
Id = id;
}

/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
/// <param name="message">Exception message</param>
public EntityNotFoundException(string message)
: base(message)
{

}

/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
/// <param name="message">Exception message</param>
/// <param name="innerException">Inner exception</param>
public EntityNotFoundException(string message, Exception innerException)
: base(message, innerException)
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public GetAllBrandsCachedQueryHandler(IUnitOfWork<int> unitOfWork, IMapper mappe

public async Task<Result<List<GetAllBrandsResponse>>> Handle(GetAllBrandsQuery request, CancellationToken cancellationToken)
{
Func<Task<List<Brand>>> getAllBrands = () => _unitOfWork.Repository<Brand>().GetAllAsync();
Func<Task<List<Brand>>> getAllBrands = () => _unitOfWork.Repository<Brand>().GetAllListAsync();
var brandList = await _cache.GetOrAddAsync(ApplicationConstants.Cache.GetAllBrandsCacheKey, getAllBrands);
var mappedBrands = _mapper.Map<List<GetAllBrandsResponse>>(brandList);
return await Result<List<GetAllBrandsResponse>>.SuccessAsync(mappedBrands);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public GetAllDocumentTypesQueryHandler(IUnitOfWork<int> unitOfWork, IMapper mapp

public async Task<Result<List<GetAllDocumentTypesResponse>>> Handle(GetAllDocumentTypesQuery request, CancellationToken cancellationToken)
{
Func<Task<List<DocumentType>>> getAllDocumentTypes = () => _unitOfWork.Repository<DocumentType>().GetAllAsync();
Func<Task<List<DocumentType>>> getAllDocumentTypes = () => _unitOfWork.Repository<DocumentType>().GetAllListAsync();
var documentTypeList = await _cache.GetOrAddAsync(ApplicationConstants.Cache.GetAllDocumentTypesCacheKey, getAllDocumentTypes);
var mappedDocumentTypes = _mapper.Map<List<GetAllDocumentTypesResponse>>(documentTypeList);
return await Result<List<GetAllDocumentTypesResponse>>.SuccessAsync(mappedDocumentTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public GetAllExtendedAttributesQueryHandler(IUnitOfWork<TId> unitOfWork, IMapper

public async Task<Result<List<GetAllExtendedAttributesResponse<TId, TEntityId>>>> Handle(GetAllExtendedAttributesQuery<TId, TEntityId, TEntity, TExtendedAttribute> request, CancellationToken cancellationToken)
{
Func<Task<List<TExtendedAttribute>>> getAllExtendedAttributes = () => _unitOfWork.Repository<TExtendedAttribute>().GetAllAsync();
Func<Task<List<TExtendedAttribute>>> getAllExtendedAttributes = () => _unitOfWork.Repository<TExtendedAttribute>().GetAllListAsync();
var extendedAttributeList = await _cache.GetOrAddAsync(ApplicationConstants.Cache.GetAllEntityExtendedAttributesCacheKey(typeof(TEntity).Name), getAllExtendedAttributes);
var mappedExtendedAttributes = _mapper.Map<List<GetAllExtendedAttributesResponse<TId, TEntityId>>>(extendedAttributeList);
return await Result<List<GetAllExtendedAttributesResponse<TId, TEntityId>>>.SuccessAsync(mappedExtendedAttributes);
Expand Down
Loading