Hi @musa,
I have tried all and none works as expected. All queries retrieve all columns from database. And it would be wrong actually to think that one way of writing the query would change the output where those should be translated into sql with the same script. This is the case in ef core.
Can you please do the test at your end to see what you get? My question still stands. How should I write queries that would only select the columns that I specify in the select dto? In ef core world any of those queries result in the same correct expected query.
I have created a ticket as wellhttps://github.com/aspnetzero/aspnet-zero-core/issues/4274
Hi @musa.demir,
When Id is used in select the translation error is NOT getting thrown. However, when I checked profiler what query gets sent to database i can see it goes and grabs all columns. So it is not expected behaviour at all. So basically select statment is useless.
Hi Ismail,
I find this weird too. It is just like all other Repository pattern.
private readonly IRepository<Product> _productRepository;
DI injection injects the product repository as above.
Then in the method I just call
var product = await _productRepository.GetAll().Select(v=> new ProductDto(){}).SingleAsync(x => x.Id == input.Id);
public class ProductDto: EntityDto{
public string Name {get;set;}
}`
This one fails.
But if I write the query as below it is fine:
var product = await _productRepository.GetAll().SingleAsync(x=>x.Id ==input>id);
var productDto = ObjectMapper.Map<ProductDto>(product);`
The problem with this is that this returns all columns from database for the product. I am trying to avoid this with select but it fails.
Anything you can think of would cause this problem?
Thanks,
.net core version: .net 5 asp zero: 10.20
I have the simplest query with select statement for efficiency so instead of selecting all columns I want to limit the selection:
var productDto = await _productRepository.GetAll().Select(d=>new ProductDto{Name = d.Name}).SingleAsync(x=>x.Id ==input.Id);
This simple query throws
The LINQ expression 'DbSet()
.Where(c => new ProductDo{ Name= d.Name}
.Id == __input_Id_0)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'.
I have written a simple ef core application with ef core 5 with simple context and above query perfectly works fine in that.
Any idea why this selection is not allowed?
Found the issue
<ItemGroup> <EmbeddedResource Include="Localization\ProjectName\*.xml;Net\Emailing\EmailTemplates\default.html" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup>
was missing from Core.csproj
@maliming I didn't try that.. But I am guessing not. I was hoping that you would know where things gone wrong and you could point me the right direction to check it. Any idea where I should be looking at?
When I run abp.localization.values in browser console it says it is not defined. Clearly while upgrading something has messed up. The issue is also on the swagger page
VERSION: .net core 3.1 and latest v9.3.0-rc.1
We are in the process of upgrading to latest and first thing we noticed is that all localized texts show names instead of values. See the screenshot attached.
Any idea why this could be happening and how can we get it back working again?
When I change the language it does not do anything but changes the flag only.
//Use database for language management Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization(); //Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-gb", true));
Tried to disabled EnableDbLocalization() but no luck.
In startup :
//Initializes ABP framework. app.UseAbp(options => { options.UseAbpRequestLocalization = false; //used below: UseAbpRequestLocalization });
Tried to change it to true and no luck
Clear all cahces and removed all cookies still the same issue.
Deleted all Abp.Localization.DefaultLanguageName settings from AppSettings and try again and no luck.
Version: asp zero 8.6 angular.
On dev we get exception with modal( sweetalert) 'Invalid username or password'. On production user does not get any modal on the wrong credantials. When I view F12 network I can see the error message comes back on authenticate call is 500 instead of 401 on production. I believe as a result the modal does not appear on production.
Any idea how to fix this? Is this an appsetting issue? or any setting we need to change on IIS to get the error modal working?
Note that when I change launchSettings.json to Production the issue occurs. On Development it shows the modal fine.
Both dev and production appsettings are indentical and the issue still persists.
Thanks,
Hi @maliming,
I know you are working on this but this is causing us trouble. There is no way to figure out what permission is required. I tried to hack you suggested in the ticket(change en to en-GB. Then I disabled all languages but en on the ui. This seems working. But the issue is that when you view the permissions you see brackets around [Permissions] any idea how we can use simple text for the permissions title instead of localizated texts?
Hi @mailiming, Any update on this issue?