-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error during EnsureCreate on sqlite db with json columns #29632
Comments
JSON columns aren't yet supported on SQLite. We should maybe have model validation for SQLite to make this clear (similar to npgsql/efcore.pg#2452). |
Note from triage: we will consider this if we don't implement SQLite support in 8: #28816 |
Any ideas for a workaround for this? I am using SQLite for tests and don't actually care about the JSON columns or the entities which have them but all tests now fail because the database creation failed. Is there some way to conditionally make them not mapped if the provider is SQLite? |
@Eirenarch Something like this in if (Database.IsSqlite())
{
modelBuilder.Ignore<Foo>();
} |
@ajcvickers thanks, turns out it was pretty easy ended up with this protected override void OnModelCreating(ModelBuilder builder)
{
if (Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite")
{
builder.Entity<MyEntity>().Ignore(myEntity => myEntity.MyProperty);
}
else
{
//normal mapping to JSON
}
...
} |
Hello,
it seems there something wrong with EFCore7 and sqlite DB, when using json columns.
Specifically, I have a context that has 2 tables, in a one-to-many relationship
and, in the onModelCreating method, are defined some columns as json
This all works well if used with a SQL Server database but, when using with a sqlite database, the
throws a System.NullReferenceException with the following stacktrace.
Would anyone know what's the cause and how to fix it?
Thanks
The text was updated successfully, but these errors were encountered: