Closed Mathieu333 closed 2 years ago
@Mathieu333 Can you provide the full exception?
Because I did import your project (slightly modified some code) and tested it, it works fine.
You can see the PR: https://github.com/zzzprojects/System.Linq.Dynamic.Core/pull/618
@StefH First of all thank you very much for taking the time to test it !
Here is the full exception.
I am really surprised it works on your side. Will take a look at that PR thanks.
@StefH I tried your PR with <PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.19" />
instead of the ProjectReference and it still throws the exception :
Maybe it is related to some sort of globalization culture issue if it is working on your side but not mine?
Yes. Probably Globalization or Culture.
What do you use for your system?
My InstalledUICulture is fr-FR. I have tried to set up CurrentCulture and CurrentUICulture to en-US before the expression but still no luck.
Mine is this:
I'll try if I can change it
After changing the culture as defined here: https://docs.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-6.0&pivots=server#statically-set-the-culture
It still works:
Thank you for your help.
I guess I am back to square one, I'll probably try a full reinstall of a clean windows on one of my comp tomorrow..
I did some searching and actually this help me :
https://github.com/dotnet/efcore/issues/14095#issuecomment-464365442
modelBuilder.Entity<TestEntity>().Property(x => x.LastModified).HasColumnType("datetime");
With this the code works indeed, it has nothing to do with Linq.Dynamic.Core and probably comes from datetime2 being the standard in EF Core.
Many thanks @StefH you are a life saver ! 🥇
1. Description
I have a blazor server project and I am using Linq.Dynamic.Core 1.2.19 and Microsoft.EntityFrameworkCore 6.0.7. So far so good a lot of the code is working great, many thanks !
The below code throws the exception.
It is apparently the same line of code as the documentation yet it does not work. The contractList is a list of Contract that can't be simpler:
The link to the database is working and the Contract table is matching the Contract class. EntityContext is working as expected.
2. Exception
Conversion failed when converting date and/or time from character string.
3. Fiddle or Project
Simple project attached, BlazorApp1.zip
you just have to change the connectionString in the EntityContext to your own database and create a very simple contract table 👍
Mine is populated like so.
Disclaimer: I am aware that the https://dotnetfiddle.net/BWGuvY test project is working as expected. I have spend a lot of time running this project from scratch and testing things around. It does not work on my computer but as you can see the project attached is very simple.
Is it just that it will not work with Blazor Server? Or could that be DateTime? ? I have similar result with the non-nullable type.
Thank you for your help !