Open tbasallo opened 6 years ago
Are you sure it's the same resources you are seeing being loaded in those SQL statements? Resources load as they are needed one resourceset and locale at a time, so you will see SQL commands for each resource set and each language being loaded like this once. It doesn't all load at once. IOW - lots of activity up front, then from cache.
Yeah - the same exact page calls into the DB with every refresh.
Any chance to you can step into that code? I've checked this in the past and do not see this behavior. The ResourceSet should be caching unless .NET Core is not holding on to it and releasing it somewhere.
I'm curious to see a call stack when it reloads on a second request with the same resources set and same locale.
I'll be working on this and see what I find. This is running about 3 SQL calls on every page load - they're fast at only 1ms, but... :)
Yes this is definitely not right - but I don't think this is the provider that's doing it - it must be the runtime that's recreating the resource sets.
I can't look at this for the next couple of weeks I have too much going on, but will take a look when my time frees up.
OK - I think I found all the culprits. Not sure if they're bugs or by design, so I didn't look for where it's happening or a fix to PR.
@tbasallo, By default in DbResourceProvider IgnoreCase =true. https://github.com/RickStrahl/Westwind.Globalization/blob/701eb72f0c85f09b3102feb1334d3466b9e87708/src/Net45/Westwind.Globalization.Web/DbResourceProvider/DbResourceProvider.cs#L93
As you are using DbSimpleResourceProvider, you probably need to set it by yourself like in https://github.com/RickStrahl/Westwind.Globalization/issues/81#issuecomment-260245090
Also ensure that your DB is not case-sensitive.
I was under the impression that the resources were cached on first load, but looking at the logs it seems that resources are loaded on every page load. Is there a setting that may have disabled this? Or do I need to enable? I looked and can't seem to find anything.
But get multiple calls per page, every time.
This file seems like caching is implemented, https://github.com/RickStrahl/Westwind.Globalization/blob/701eb72f0c85f09b3102feb1334d3466b9e87708/src/Net45/Westwind.Globalization.Web/DbSimpleResourceProvider/DbSimpleResourceProvider.cs
Environment: Azure ASP.NET Core 2.1
SQL:
select Value,Type from Localizations where ResourceId=@ResourceId and ResourceSet=@ResourceSet and LocaleId=@LocaleId
Config: