Skip to content

Releases: magiccodingman/Magic.IndexedDb

Magic IndexedDB v2.0.1

09 Jun 16:35
Compare
Choose a tag to compare

Magic IndexedDB v2.0.1

NuGet: Magic.IndexedDb v2.0.1

Core Fixes

Additional changes to the .Cursor() capabilities specifically to ordering which furthers the last updates goals of getting more indexable akin queried results.

What's New

A new .Cursor() query capability added of, ".StableOrdering()" in which you can utilize like:

query.Cursor(x => x.TestInt > 2).StableOrdering().Take(2).ToListAsync()

Documentation as been updated with this new syntax. You can refer to this documentation for the most in depth explanation of what it does and why it exists:
https://sayou.biz/Magic-IndexedDB-Understanding-Ordering

Final Thoughts

This should be the last update to cursor ordering. Goal is that this remains constant in time as it's important for developer trust that this functionality stays true so that built queries aren't messed up in the future. Only updates that'd occur from here is if additional issues/bugs are found, but the idea/protocol should stay true moving forward. This should cement this projects ordering philosophy.

Note
I've removed "alpha" from the nuget library naming. It's not that this project isn't in alpha, but it's seeing significant stability. Plus the "alpha" wordage on nuget is messing with ordering and showing the project as "depreciated", which is incorrect.

Magic IndexedDB v2.0.0-alpha9

03 Jun 22:41
Compare
Choose a tag to compare

Magic IndexedDB v2.0.0-alpha9

NuGet: Magic.IndexedDb v2.0.0-alpha9

Core Fixes

Significant repair and alterations to .Cursor. Alterations to the interface of what's allowed has occurred and significant bug fixes. Ordering has been better replicated as well to have the meta data driven ordering for Take, Skip, TakeLast to better replicate indexedDB ordering in memory. This includes the cursor replicating situations where the predicate in the Where now identifies indexed columns and orders by the indexed columsns, then by the inserted row ordering. As this replicates indexed query logic which is what the cursor engine is meant to do. As the purpose is that indexed versus cursor queries should have the same syntax and intent to simplify use.

Significant boosts to reliability should have occurred this update. Unit tests have been refactored to test many automated pathways. Tests went from ~90 unit tests to now 357 unit tests to validate a significant number of paths and syntax use.

The interfaces have been limited further, but for good reason to better replicate what's actually possible. Otherwise returned results are not able to process intent as it should. From here, once more stability is brought, the .Cursor can be upgraded to grow in power instead of reeling it back.

There was a lot of oversight in unit testing recently due to browser caching claiming everything was wiped when that was not actually true. This created perceived reliability when it was failing in reality after specific updates. Unit tests are being beefed up to better catch pathway errors and prevent caching issues during testing.

Final Thoughts

If you notice any issues with bad path syntax that breaks or ordering, please leave an issue ticket!

Magic IndexedDB v2.0.0-alpha8

02 Jun 16:03
Compare
Choose a tag to compare

Magic IndexedDB v2.0.0-alpha8

Special thanks to @Ard2025 for their significant help in this patch. A ton of core functionality has been cleaned up, fixed, and clarified—especially around cursor queries and interface enforcement. Here's what's new:

NuGet: Magic.IndexedDb v2.0.0-alpha8


Core Fixes

  • Blazor Server yield safety fixed
    The JavaScript message size variable was not being correctly implemented. This has now been fixed, ensuring safe and reliable streaming of large result sets via .AsAsyncEnumerable()—especially in Blazor Server mode. Related to #79

  • Indexable .OrderBy() was crashing
    A missing logic set was preventing indexable .OrderBy() queries from executing correctly. This has now been resolved. Indexed ordering now works as expected and no longer crashes when used correctly. related to #92


Cursor Query Syntax Fully Fixed

Several cursor query operations were broken and causing infinite loops. A new shared helper class was introduced to reduce duplicate logic and unify the behavior between cursor and indexable query extensions.

The following cursor methods are now fully fixed and tested:

  • .OrderBy()
  • .OrderByDescending()
  • .Skip()
  • .Take()
  • .TakeLast()
  • .FirstOrDefault()
  • .LastOrDefault()

All have unit tests and consistent cursor behavior.


Interface Enforcement Update – No More Accidental Cursor Guarantees

The .Where(x => x) interface is designed to provide a non-zero chance of triggering indexable queries—it's not guaranteed, but it's safe.

However, an oversight allowed this anti-pattern:

query.Where(x => x).OrderBy(x => ...)

This breaks IndexedDB’s capabilities, because once you append .OrderBy() after a .Where(), the result is no longer indexable. Previously, Magic IndexedDB silently corrected this by switching to a cursor, but it should have been disallowed by the interface itself.

This has now been fixed. You can no longer append .OrderBy() after a .Where() in the optimized path.

If you need full control (e.g. combining .Where() and .OrderBy() freely), use .Cursor() instead to unlock the meta-driven query engine.

Learn more about how and when to use .Cursor() here:
https://sayou.biz/Magic-IndexedDB/Blazor/Blazor-Where-Vs-Cursor


Documentation Updates

Cursor vs Where — Blazor-Specific Docs Now Live

A brand new guide is available explaining the difference between .Where() and .Cursor() in C# Blazor:
https://sayou.biz/Magic-IndexedDB/Blazor/Blazor-Where-Vs-Cursor

Skip Before Take — Fully Explained

A commonly reported confusion (Issue #85) has now been formally documented.

This is not a bug—it's an intentional behavior in Magic IndexedDB based on how IndexedDB itself works.

Read the explanation:
https://sayou.biz/Magic-IndexedDB-Why-Take-Then-Skip


Thank you to everyone using Magic IndexedDB. This release tightens guarantees, improves correctness, and reinforces what makes the system so powerful: performance with safety-first design. 🚀

Magic IndexedDB v2.0.0-alpha7

29 May 15:44
Compare
Choose a tag to compare

NuGet: Magic.IndexedDb v2.0.0-alpha7

Fixes

  • alpha2 - Resolves issues with static non mapped variables within magic table class.
  • alpha3 - Changed service from Singleton to Scoped for resolving Blazor Server issues with no WASM down sides.
  • alpha4 - @yueyinqiu changes to repair access to disposed objects in Blazor Server and resolving warnings.
  • alpha5 - @yueyinqiu changes to fix delete item function call.
  • alpha6 - Fixed bulk delete.
  • alpha7 - @Ard2025 both provided and pointed to the solutions to the end token array and dynamic object serialization issues.

Next Steps

Since ~2 months ago when version 2.0 alpha was launched, we've had a good amount of updates, bug fixes, and support! I believe the project is now stable enough to move forward with the migration functionality.

I have been really limited on time recently, but I should have more free time in the near future and the migration feature will help bring a closing end goal to the anticipated full launch of v2.0. Thanks for all the community support, it means a lot!

Magic IndexedDB v2.0.0-alpha1 Release Notes

28 Mar 16:39
Compare
Choose a tag to compare

🚀 Magic IndexedDB A New Era

The First Official Drop of Version 2 – A New Era Begins
NuGet: Magic.IndexedDb v2.0.0-alpha6
Docs: sayou.biz/Magic-IndexedDB-Index

IMPORTANT

This is an alpha release. There is ~94 unit tests on the current LINQ to IndexedDB code that're all passing. But everything from the LINQ to the basic CRUD operations have been heavily altered. This is being released under the understanding that it seems stable, but that this is the very first launch of v2.0.

HotFixes

  • alpha2 - Resolves issues with static non mapped variables within magic table class.
  • alpha3 - Changed service from Singleton to Scoped for resolving Blazor Server issues with no WASM down sides.
  • alpha4 - @yueyinqiu changes to repair access to disposed objects in Blazor Server and resolving warnings.
  • alpha5 - @yueyinqiu changes to fix delete item function call.
  • alpha6 - Fixed bulk delete.

⚠️ Heads Up: This is NOT a regular update. This is a full-blown evolution.

Magic IndexedDB v2.0.0-alpha1 marks the end of the v1.0 era and the birth of something entirely new. The codebase, architecture, query engine, and capabilities have been rebuilt from the ground up. If you're expecting minor enhancements—prepare to have your mind blown.


🔥 What’s New (At a Glance)

  • All-New Query Engine

    • Not a rewrite. A reinvention.
    • No more loading entire datasets into memory.
    • Every query is streamed, optimized, and intentionally executed.
  • True LINQ to IndexedDB — for the First Time Ever

    • Full translation of LINQ expressions into native IndexedDB operations.
    • Supports deeply nested && / || logic.
    • Real-time intent translation across all frameworks.
  • Universal Predicate Translation Layer

    • Translates LINQ expressions into a cross-framework, framework-agnostic query format.
    • Seamlessly handles logic flattening, dynamic nesting, and optimization without reflection.
  • Streaming, Not Loading

    • Data is never loaded into memory unless explicitly requested.
    • AsAsyncEnumerable() and optimized cursor streams make even massive datasets feel lightweight.
  • Syntax You’ve Never Seen Before in IndexedDB

    • StartsWith, Contains, complex null checks, .Value parsing on nullable types.
    • Nested object support, DateTime range translation, and more — natively translated.
  • Interface-Enforced Query Safety

    • Skip before Take? Not allowed.
    • Cursor-only logic? Explicit.
    • Indexed queries? Auto-optimized or enforced via smart interfaces.
  • Deep Query Magic

    • Flattened predicate operations.
    • Auto-index fallback detection.
    • Combined index optimizations.
    • True FirstOrDefault, LastOrDefault, pagination support, and so much more.

💣 Breaking Changes

  • This is a hard reset of the library's API surface.
    • v2.0.0 uses completely different syntax and architecture than v1.0.x.
    • Existing codebases will need to migrate.
    • Don’t worry—we’ve got you covered with new docs:
      👉 Migration Guide & LINQ Docs

🛠️ Still In Progress

  • Migration System Refactor
    A total overhaul of the migration pipeline is underway. For now:
    • The v1.x migration system still works.
    • A new, smarter system will be released in the coming updates.

⚡ Why This Matters

This isn’t just the next version of Magic IndexedDB —
this is the first true intent-based, LINQ-to-IndexedDB engine in the world.

You're not writing queries. You're expressing truth, and the engine takes care of the madness beneath.

There is no IndexedDB library like this in the entire Blazor ecosystem — or anywhere, really.


🧠 Before You Dive In

Make sure to check the following:

  • 📚 Full Setup Docs
  • 🧭 Learn the new Query<T>() system
  • ⚙ Understand indexed vs. cursor queries
  • ✅ Read the "Ordering & Pagination" section (IndexedDB is weird—Magic makes it sane)

🧪 Feedback Welcome

This is an alpha drop — but it’s already miles ahead of anything else.
Your feedback will help refine the final shape of v2.0.


🧙 Closing Words

The simple goal of bringing IndexedDB to Blazor turned into the first LINQ to IndexedDB framework to exist in this capacity for any language. This library will be opening up to additional programming communities in the future. But for now, Blazor developers gets the first drop.

Magic IndexDB v1.0.12 Release Notes

10 Mar 23:16
Compare
Choose a tag to compare

🚀 Hotfix/Patch

📢 NuGet Release: Magic.IndexedDb v1.0.12

This hotfix/patch resolves issues that were created from and prior to version 1.0.11.

🔨 Bug Fixes

Resolved Skip complex query issues.
Fixed null value serialization issues.
Corrected error which fixes/allows developers to compare to nulls like, (x.DateOfBirth == null) or (x.DateOfBirth != null). Note for reference the Equals and !Equals are supported operations as well.
Fixed multiple edge case Not Equals != scenarios.

The Last V1 Update

This is the very last update of version 1. For V1 documentation please go to:
click here to go to the legacy documentation for v1.0.12

There is zero additional expected support for V1 as version 2.0 will be the next evolution of this project.

Magic IndexDB v1.0.11 Release Notes

10 Mar 16:45
9664c6a
Compare
Choose a tag to compare

🚀 Performance Overhaul, Streamed Queries, and Future-Proofed Execution

📢 NuGet Release: Magic.IndexedDb v1.0.12

  • Use the v1.0.12 hotfix/patch

This update removes major bottlenecks, eliminates redundant serialization, drastically improves query performance, and introduces new future-proofed execution methods.


🔥 Key Enhancements in v1.0.11

1️⃣ Eliminated Blazor Interop Overhead – No More Double Serialization

  • Removed Blazor's built-in interop handling, replacing it with a custom system using magicDbMethods.js.
  • Eliminates redundant JSON serialization & deserialization, vastly improving performance.
  • 🚀 Bandwidth Increase:
    • 4.4x on Blazor WASM.
    • 2,250x on Blazor Server (SignalR).

2️⃣ Streamed Async Communication – No More Transfer Limits

  • Moved all data transfers to streamed async communication, bypassing Blazor’s built-in size restrictions:
    • No more 16MB limit on Blazor WASM.
    • No more 32KB SignalR limit on Blazor Server.
    • Uncapped data transfer, enabling handling of larger datasets.
  • 🚀 Performance gain outweighs the minor latency increase due to eliminating double serialization.

3️⃣ New [MagicName] Attribute – Rename Columns Without Indexing

  • New [MagicName("NewPropertyName")] attribute allows renaming columns in IndexedDB without forcing them to be an index, unique key, or primary key.
  • Example Usage:
    public class Person
    {
        [MagicPrimaryKey("id")] 
        public int Id { get; set; }
        
        [MagicName("FullName")]
        public string Name { get; set; }
    }
    • Results: The Name property is stored in IndexedDB as "FullName" but behaves normally in C#.
    • Benefit: Greater flexibility in defining storage structure without unnecessary indexing.

4️⃣ Major Boost to where Query Performance

  • Now utilizes IndexedDB cursors instead of inefficient in-memory filtering.
  • 🚀 Drastic reduction in memory usage and execution time.
Feature Old Version New Version Improved?
Dynamically handles conditions (Equal, GreaterThan, LessThan, etc.) ✅ Yes ✅ Yes ❌ No
Supports OR conditions (jsonQueries with multiple conditions) ✅ Yes ✅ Yes (parallel execution) Improved
Supports sorting (orderBy, orderByDescending) ✅ Yes ✅ Yes ❌ No
Supports pagination (skip, take, takeLast) ✅ Yes ✅ Yes ❌ No
Supports indexed queries when possible ❌ No (forced in-memory filtering via .and()) ✅ Yes (checks for indexed properties first) Improved
Supports cursor-based iteration for large datasets ❌ No (always loads everything into memory) ✅ Yes (avoids memory bloat with .each()) Improved
Executes OR queries in parallel ❌ No (sequential execution) ✅ Yes (Promise.all() for speed) Improved

This also does mean that you can now query non indexed columns with the LINQ Where clause as long as it doesn't have the "MagicNotMapped" attribute!


🔄 Future-Proofed Query Execution – Execute() Is Now Obsolete

  • Deprecated Execute() and introduced new optimized methods:
Method Description
ToListAsync() Executes the MagicQuery and returns results as List<T>.
AsAsyncEnumerable() Executes the MagicQuery and returns results as IAsyncEnumerable<T>.
{NOT YET SUPPORTED} ToList() (FUTURE FEATURE) Executes the MagicQuery and returns results as List<T>.
{NOT YET SUPPORTED} AsEnumerable() (FUTURE FEATURE) Executes the MagicQuery and returns results as IEnumerable<T>.
  • ToListAsync() and AsAsyncEnumerable() are now the recommended execution methods for better optimization and long-term stability.
  • Planned Features: Synchronous ToList() and AsEnumerable() methods will be introduced in a future update.
  • Important note about AsAsyncEnumerable. The current AsAsyncEnumerable emulates properly providing "IAsyncEnumerable" but this feature has not yet been fully implemented. But it is a future proofed version that is safe to utilize even if full functionality isn't there yet. As it's currently just returning an IEnumerable as IAsyncEnumerable.

Complex Query Support – LINQ-Style Queries for IndexedDB

IndexedDB now supports advanced LINQ-style querying with full filtering, ordering, and pagination capabilities. Nested OR conditions is what this update brings to life. You can now build complex nested where statements in full!

Example Query:

await manager.Where<Person>(
        x => x.Name.StartsWith("c", StringComparison.OrdinalIgnoreCase)
        || x.Name.StartsWith("l", StringComparison.OrdinalIgnoreCase)
        || x.Name.StartsWith("j", StringComparison.OrdinalIgnoreCase) && x._Age > 35
    ).OrderBy(x => x._Id).Skip(1).ToListAsync();

People In IndexedDB!

ID Name Age Not Mapped Access
17 Zack 45 CanRead
18 Luna 35 CanRead, CanWrite
19 Jerry 35 CanRead, CanWrite, CanCreate
20 Jon 37 CanRead
21 Jack 37 CanRead, CanWrite
22 Cathy 22 CanRead, CanWrite
23 Bob 69 CanRead
24 Alex 80 None

Returned Results:

Name: Cathy - Age: 22
Name: Luna - Age: 35
Name: Jon - Age: 37
Name: Jack - Age: 37

🔎 Query Breakdown:

  1. Filters names starting with "C", "L", or "J" (if age > 35).
  2. Orders by ID in ascending order.
  3. Skips the first result (correct pagination support).
  4. Uses IndexedDB cursors to optimize execution.

🔨 Other Fixes & Enhancements

Implemented cursor-based querying for non-indexed fields.
Fixed complex query translation issues.
Corrected camel-case property handling in attributed Magic Tables.
Refactored execution commands for better usability and performance.


🔧 Upcoming Refactor – Simplifying MagicDbFactory for Seamless Database Access

A major refactor is planned for how users interact with the MagicDbFactory manager, aiming to eliminate all manual configuration and streamline database initialization.

🚀 What’s Changing?

  • No more user input required – databases will be automatically initialized and managed.
  • Simplified API usage – making Magic.IndexedDb easier to work with across multiple databases.

Known Issues & Current Limitations:

  • There are existing bugs and inconsistencies when accessing multiple databases under certain scenarios.
  • These issues have always existed but will be fully addressed in the upcoming refactor.

🔧 Priority Fix: This refactor is a top priority and will be implemented in an upcoming update.


📝 Final Thoughts

This release drastically enhances IndexedDB performance in Blazor, eliminates wasteful serialization, and introduces optimized, future-proofed execution methods.

📢 NuGet Release: Magic.IndexedDb v1.0.12

Magic IndexDB v1.0.10 Release Notes

09 Mar 17:40
Compare
Choose a tag to compare

Special Thanks 🙌

A huge shoutout to @yueyinqiu for major contributions and support in this update! Your help has been invaluable in refining and optimizing the project.


🔥 Major Enhancements

✅ New Unit Test Library 🧪

  • A dedicated unit testing library has been introduced to rigorously validate all functionality.
  • This significantly improved testing coverage, allowing us to catch and resolve numerous edge cases and issues.

⚡ Complete Serialization Overhaul 🚀

  • Massive rework of the serialization process, improving performance, reliability, and capability to a whole new level.
  • Introduced a fully customized serializer and deserializer, removing significant runtime reflections and unnecessary processing.
  • New caching techniques drastically improve performance:
    • Discovery and caching of information now happens primarily at startup, ensuring minimal runtime overhead.
    • Information is cached once per encounter and reused efficiently.
  • This refactor opens doors for future enhancements—share your ideas in the GitHub Discussions.

🐛 Bug Fixes

This release isn’t just about performance! Multiple critical bug fixes have been addressed:

✔️ Fixed retrieving complex types.
✔️ Fixed usage of variables in Where predicates.
✔️ Fixed Array.Contains() behavior.
✔️ Fixed ensuring unique results return correctly.
✔️ Fixed issues with Contains clauses.
✔️ Fixed retrieving ID of newly added records.
✔️ Fixed numerous issues related to enums.
✔️ Fixed Ignore attributes now properly respected.
✔️ Fixed handling of multiple attributes in nested operations.

🚨 These are just some of the fixes—many more improvements have been made! 🚨


⚠️ Breaking Changes & Deprecations

🔑 Encryption Attribute Removed

  • The encryption attribute has been removed, as we are planning a much better way to reintroduce encryption in the future.
  • It is now marked as obsolete and no longer functions, but remains in place to allow projects time to migrate.
  • Full removal will occur in future updates.

💡 Join the Discussion

This update brings major improvements, but there’s always room for more! If you have ideas for enhancements or additional features, share your thoughts in the GitHub Discussions.

🔥 Thank you to everyone who contributed to this release! Your feedback, support, and contributions are what make this project great.

Nuget Release:
https://www.nuget.org/packages/Magic.IndexedDb/1.0.10