Closed houssam-saissi closed 7 years ago
I'll check this, had to rework the lifecycles in the .NET 2.0, What database do you use?
Greetings Damien
I think I see the problem, will fix this today, or at the latest tomorrow
Hi, Thank you for reply :) .
I use a Sqlite database as in the project example. I think we have to create the resource if it does not exist otherwise we just have to read it.
I use .Net Core 2.0
Thanks,
I've added this code to avoid the error, but I think this has to be done differently :) :
var existingRecord = _context.LocalizationRecords.Where(data => data.ResourceKey.Equals(resourceKey) && data.Key.Equals(key) && data.LocalizationCulture.Equals(culture)).FirstOrDefault();
if (existingRecord == null)
{
_context.LocalizationRecords.Add(localizationRecord);
}
else
{
localizationRecord.Id = existingRecord.Id;
_context.LocalizationRecords.Update(existingRecord);
}
_context.SaveChanges();
fixed, will release this in version 2.0.2
Hi @houssam-saissi Thanks for reporting.
fixed in https://www.nuget.org/packages/Localization.SqlLocalizer/2.0.2
Could you please verify
reetings Damien
Hi @damienbod
Thaanks it works very well solution :) Thanks for helping me, your project is so great. I recommend this project.
Hi @damienbod
Thanks for your help, it works very well :) The problem is solved.
Hello,
Thank you very much for your project. it's very interesting :). However, when I run the project the first time I get the error in the screenshot (screen-1.png).
I checked at the database and the row is inserted properly. When I inspect the code, it is if it passes 2 times by the function "_context.LocalizationRecords.Add (localizationRecord);" In the "DevelopmentSetup.cs"
Note that after a second use, the page is displayed correctly.
This problem unfolds each time a new resource is added to the project.
Any help ? Thank you :)