Releases: magiccodingman/Magic.IndexedDb
Magic IndexDB v1.0.12 Release Notes
π 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.
Magic IndexDB v1.0.11 Release Notes
π 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.
- Results: The
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()
andAsAsyncEnumerable()
are now the recommended execution methods for better optimization and long-term stability.- Planned Features: Synchronous
ToList()
andAsEnumerable()
methods will be introduced in a future update. - Important note about
AsAsyncEnumerable
. The currentAsAsyncEnumerable
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:
- β Filters names starting with "C", "L", or "J" (if age > 35).
- β
Orders by
ID
in ascending order. - β Skips the first result (correct pagination support).
- β 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
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