Comments (8)
This was already fixed in the new release. Which version of the nuget package are you using?
from dotnet-webapi-starter-kit.
rc-3
from dotnet-webapi-starter-kit.
public async Task<TDto> GetByIdAsync<T, TDto>(Guid entityId, BaseSpecification<T> specification, CancellationToken cancellationToken = default)
where T : BaseEntity
where TDto : IDto
{
string cacheKey = CacheKeys.GetCacheKey<T>(entityId);
byte[] cachedData = !string.IsNullOrWhiteSpace(cacheKey) ? await _cache.GetAsync(cacheKey, cancellationToken) : null;
if (cachedData != null)
{
await _cache.RefreshAsync(cacheKey, cancellationToken);
var entity = _serializer.Deserialize<TDto>(Encoding.Default.GetString(cachedData));
return entity;
}
else
{
IQueryable<T> query = _dbContext.Set<T>();
if (specification != null)
query = query.Specify(specification).Where(a => a.Id == entityId);
var entity = await query.FirstOrDefaultAsync(cancellationToken: cancellationToken);
var dto = entity.Adapt<TDto>();
if (dto != null)
{
if ((specification?.Includes?.Count == 0) || specification == null)
{
var options = new DistributedCacheEntryOptions();
byte[] serializedData = Encoding.Default.GetBytes(_serializer.Serialize(dto));
await _cache.SetAsync(cacheKey, serializedData, options, cancellationToken);
}
return dto;
}
throw new EntityNotFoundException(string.Format(_localizer["entity.notfound"], typeof(T).Name, entityId));
}
}
here when specification is null no filtering is done
from dotnet-webapi-starter-kit.
Please check RC 4 . This bug was fixed. Do let me know if you face any additional issues related to this. Thanks
https://www.nuget.org/packages/FullStackHero.WebAPI.Boilerplate/0.0.4-rc
from dotnet-webapi-starter-kit.
the bug still exit in the RC 4
I think you have fixed it for this function
public async Task<T> GetByIdAsync<T>(Guid entityId, BaseSpecification<T> specification = null, CancellationToken cancellationToken = default)
not the other one
public async Task<TDto> GetByIdAsync<T, TDto>(Guid entityId, BaseSpecification<T> specification, CancellationToken cancellationToken = default)
the answer
if (specification != null)
query = query.Specify(specification).Where(a => a.Id == entityId);
else
query = query.Where(a => a.Id == entityId);
from dotnet-webapi-starter-kit.
Thanks for pointing it out. Could you test it now? I have added the changes.
from dotnet-webapi-starter-kit.
Please pull the latest code from the repository and try.
from dotnet-webapi-starter-kit.
Thanks It's Work
from dotnet-webapi-starter-kit.
Related Issues (20)
- [BUG] New API returns 404 from docker container
- Auditable Entity [BUG]
- Where to put 'app.UseRateLimiter()'
- Serilog High Memory Usage - Memory Leak & Solution [BUG]
- [BUG] CORS policy seetings for Flutter app
- [Package] MediatR Extension version 11.1.0 deprecated
- Allow Tenant Admin to view all Audit Trails of all users. HOT 1
- [BUG] _repository.PaginatedListAsync with spec error
- [BUG] Can't Start on MacOS HOT 1
- Use wolverine for new version?
- Payment Service
- Model relationship with ApplicationUser HOT 1
- [BUG] Updating a User sets a Cookie
- [BUG] ApiVersioning is not working HOT 2
- [BUG] MediatR - Startups issues
- [Doc] How to use POT / Localization / Translation HOT 2
- [BUG] CORS origin error while on subdomain
- [BUG] Random error "Unable to connect the server"
- [BUG]
- [BUG] [v2] Swagger WithSummary / WithDescription metadata doesnt show up on the UI HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet-webapi-starter-kit.