Coder Social home page Coder Social logo

chanan / blazordb Goto Github PK

View Code? Open in Web Editor NEW
70.0 70.0 19.0 350 KB

In memory, persisted to localstorage, database for .net Blazor browser framework

License: The Unlicense

C# 79.85% JavaScript 1.08% CSS 2.91% HTML 16.16%
blazor database linq localstorage

blazordb's People

Contributors

3x0dv5 avatar chanan avatar lukynmatuska avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

blazordb's Issues

Getting IndexOutOfRange exception when initializing BlazorDB

After adding two records to a StorageSet, during setup of the BrowserServiceProvider, and calling AddBlazorDB, getting an IndexOutOfRangeException:

Here's the full stack trace:

MonoPlatform.ts:70 Uncaught (in promise) Error: System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at BlazorDB.Storage.StorageManagerLoad.GetIdFromString (System.String stringToSearch, System.Int32 startFrom) <0x1b9bc28 + 0x0003c> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManagerLoad.FindIdInSerializedModel (System.String serializedModel) <0x1b9b6c8 + 0x0002a> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManagerLoad.LoadStringModels (System.Type contextType, System.Collections.Generic.IEnumerable`1[T] storageSets) <0x1b79508 + 0x000ea> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManagerLoad.LoadContextFromStorageOrCreateNew (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Type contextType) <0x1af14b0 + 0x0002c> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManager.LoadContextFromStorageOrCreateNew (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Type contextType) <0x1af0fa8 + 0x00020> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.ServiceCollectionExtensions.RegisterBlazorDb (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Collections.Generic.IEnumerable`1[T] types) <0x1af08c0 + 0x0004e> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.ServiceCollectionExtensions.Scan (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Reflection.Assembly assembly) <0x1a3c9a0 + 0x00022> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.ServiceCollectionExtensions.AddBlazorDB (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Action`1[T] configure) <0x1a47f28 + 0x0006e> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at ACMEBlazor.Program+<>c.<Main>b__2_0 (Microsoft.Extensions.DependencyInjection.IServiceCollection services) <0x1a47448 + 0x0003c> in <dbc4da5cd36641039edcb92d67a310f6>:0 
  at Microsoft.AspNetCore.Blazor.Browser.Services.BrowserServiceProvider..ctor (System.Action`1[T] configure) <0x18c3fd8 + 0x0003a> in <7da830e0eabd429898584695ab9fd9e5>:0 
  at ACMEBlazor.Program.Main (System.String[] args) <0x18c3928 + 0x00026> in <dbc4da5cd36641039edcb92d67a310f6>:0 
  at BlazorDB.Storage.StorageManagerLoad.GetIdFromString (System.String stringToSearch, System.Int32 startFrom) <0x1b9bc28 + 0x0003c> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManagerLoad.FindIdInSerializedModel (System.String serializedModel) <0x1b9b6c8 + 0x0002a> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManagerLoad.LoadStringModels (System.Type contextType, System.Collections.Generic.IEnumerable`1[T] storageSets) <0x1b79508 + 0x000ea> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManagerLoad.LoadContextFromStorageOrCreateNew (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Type contextType) <0x1af14b0 + 0x0002c> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.Storage.StorageManager.LoadContextFromStorageOrCreateNew (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Type contextType) <0x1af0fa8 + 0x00020> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.ServiceCollectionExtensions.RegisterBlazorDb (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Collections.Generic.IEnumerable`1[T] types) <0x1af08c0 + 0x0004e> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.ServiceCollectionExtensions.Scan (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Reflection.Assembly assembly) <0x1a3c9a0 + 0x00022> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at BlazorDB.ServiceCollectionExtensions.AddBlazorDB (Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Action`1[T] configure) <0x1a47f28 + 0x0006e> in <64e9d65131cb416192abd90ed76d00cb>:0 
  at ACMEBlazor.Program+<>c.<Main>b__2_0 (Microsoft.Extensions.DependencyInjection.IServiceCollection services) <0x1a47448 + 0x0003c> in <dbc4da5cd36641039edcb92d67a310f6>:0 
  at Microsoft.AspNetCore.Blazor.Browser.Services.BrowserServiceProvider..ctor (System.Action`1[T] configure) <0x18c3fd8 + 0x0003a> in <7da830e0eabd429898584695ab9fd9e5>:0 
  at ACMEBlazor.Program.Main (System.String[] args) <0x18c3928 + 0x00026> in <dbc4da5cd36641039edcb92d67a310f6>:0 
    at Object.callMethod (MonoPlatform.ts:70)
    at Object.callEntryPoint (MonoPlatform.ts:47)
    at Boot.ts:38
    at step (UriHelper.ts:99)
    at Object.next (UriHelper.ts:99)
    at fulfilled (UriHelper.ts:99)

Set other side of a relationship automatically

For example:

var person = new Person { FirstName = "Many", LastName = "Test" };
var address1 = new Address { Street = "Many test 1", City = "Saved as a reference" };
var address2 = new Address { Street = "Many test 2", City = "Saved as a reference" };
person.OtherAddresses = new List<Address> { address1, address2 };
Context.People.Add(person);
Context.SaveChanges();

Right now, in the above code snippet there is no navigation property from Address to Person. If one was added to Address it would have to be manually set to the person instance:

var person = new Person { FirstName = "Many", LastName = "Test" };
var address1 = new Address { Street = "Many test 1", City = "Saved as a reference", Person = person };
var address2 = new Address { Street = "Many test 2", City = "Saved as a reference", Person = person };
person.OtherAddresses = new List<Address> { address1, address2 };
Context.People.Add(person);
Context.SaveChanges();

Make this automatic in SaveChanges()

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.