Code Monkey home page Code Monkey logo

blazorwasmsqlitetest's Introduction

BlazorWasmSQLiteTest

Testing client-side SQLite in Blazor WebAssembly

.NET

blazorwasmsqlitetest's People

Contributors

codemonkey85 avatar

Watchers

 avatar  avatar

Forkers

elikar-km

blazorwasmsqlitetest's Issues

adding new properties to ToDo class generate EF Core exception

Added new properties to ToDo class and
`public class Todo
{
[Key]
public int Id { get; set; }

    public string Title { get; set; }

    public bool IsComplete { get; set; }

    public string Property1 { get; set; }
    public string Property2 { get; set; }
    public string Property3 { get; set; }
    public string Property4 { get; set; }
    public string Property5 { get; set; }
    public string Property6 { get; set; }
}`

And modified ClientSideDbContext.cs
`protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

        modelBuilder.Entity<Todo>().HasData(new Todo[]
        {
            new Todo { Id = 1, Title = "Todo 1", IsComplete = false, Property1 = "p1", Property2 = "p2", Property3 = "p3", Property4 = "p4", Property5 = "p5", Property6 = "p6"},
            new Todo { Id = 2, Title = "Todo 2", IsComplete = false, Property1 = "p1", Property2 = "p2", Property3 = "p3", Property4 = "p4", Property5 = "p5", Property6 = "p6" },
            new Todo { Id = 3, Title = "Todo 3", IsComplete = false, Property1 = "p1", Property2 = "p2", Property3 = "p3", Property4 = "p4", Property5 = "p5", Property6 = "p6" },
        });
    }`

The Exception is:
An exception occurred while iterating over the results of a query for context type 'BlazorWasmSQLiteTest.ClientSideDbContext'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such column: t.Property1'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)

I have to manually delete the IndexedDB.SqliteStorage using F12 then reload the page, only then application is running fine and no more EF exception.
please advise, why does this happen whenever I added new properties?

thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.