Skip to content
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

Feature/api design #5

Merged
merged 3 commits into from
Jul 22, 2024
Merged

Feature/api design #5

merged 3 commits into from
Jul 22, 2024

Commits on Jul 17, 2024

  1. Enhance data context and DI setup

    This commit introduces the IXperienceDataContext interface and its concrete implementation, XperienceDataContext, to centralize the data context in the Xperience by Kentico CMS application. It includes methods for accessing content item, page content, and reusable schema contexts. Additionally, the DependencyInjection.cs file has been updated to register IXperienceDataContext as a scoped service, improving the dependency injection setup. Interface adjustments include the introduction of a marker interface, IProcessor, and an update to IProcessor<T> to inherit from it, enhancing the processor type system. Code organization has been improved with new using directives for better readability and maintainability. These changes collectively improve the application's architecture, making it more organized, modular, and extensible.
    bluemodus-brandon committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    91c5f5f View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2024

  1. Enhance dynamic query handling and caching

    This commit introduces significant enhancements to the framework's query handling and caching mechanisms. Specifically, it adds a new private field `_parameters` in `ContentItemContext.cs` and `PageContentContext.cs` to dynamically store query parameters. The constructors of these classes have been updated to initialize this field, ensuring it's ready to store query parameters upon object instantiation.
    
    Furthermore, the dynamic handling of query parameters has been improved by populating the `_parameters` collection with parameters extracted from the `QueryParameterManager` using the `GetQueryParameters().ToList()` method. This occurs within a context where expressions are visited to dynamically build up the query parameters.
    
    The cache key generation method `GetCacheKey` in both mentioned contexts has been modified to include the hash code of the `_parameters` collection. This ensures that the cache key is unique based on the specific query parameters, improving the accuracy of cached data retrieval.
    
    In `QueryParameterManager.cs`, enhancements include the introduction of a new private field `_params` to store query parameters, updates to constructors for initializing this field, and the addition of a `GetQueryParameters` method to return the query parameters collection. The `AddParam` method allows adding new key-value pairs to the `_params` collection, and modifications in various condition handling methods ensure that query parameters are appropriately added to this collection. After applying conditions, the `ApplyConditions` method clears the `_params` collection to reset the state for subsequent queries.
    
    These changes collectively improve the framework's ability to construct queries dynamically with varying parameters and enhance cache management by incorporating query-specific details into cache keys.
    bluemodus-brandon committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    ccdf7ba View commit details
    Browse the repository at this point in the history
  2. Reset query parameters after data fetch

    In both `ContentItemContext.cs` and `PageContentContext.cs` within the `XperienceCommunity.DataContext` namespace, modifications have been made to clear the `_parameters` collection post-fetching results from cache or executing queries asynchronously. This change ensures the reset of any query parameters after each operation, enhancing the reliability and predictability of data fetching operations. Specifically, `_parameters.Clear();` is added after results are obtained from `GetOrCacheAsync` in both contexts, followed by appropriate result handling. This update aims to prevent the unintended reuse of query parameters in subsequent operations.
    bluemodus-brandon committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    a24c802 View commit details
    Browse the repository at this point in the history