Dynamic Columns

Thread is closed for posting
2 posts, 0 answers
  1. Bilal Haider
    Bilal Haider avatar
    9 posts
    Member since:
    Aug 2012

    Posted 03 Aug 2014 Link to this post

    As per the business requirements, we are suppose to provide the facility to create dynamic columns for ANY table at the runtime (when setting up the system for first time or reflecting the business rule upgrade).

    As an initial possible solution, we are going for a three table solution
    1. Table Index
    2. another table having the table index and the details of the custom field
    3. another table referencing the custom field, the row id of the corresponding table and a column saving the value for custom field

    In the prototype, before the appearing of this business rule, we adopted the database first approach but for the product we had reached the conclusion of code first (fluent API) approach.
    Now, after this new business rule,
    - Will we be able to implement this requirement using DataAcess?
    -- Is it still possible to proceed with the code first approach?
    --- Or we should go for some other approach to this business requirements

    We have done only a single prototype using DataAccess and not sure of its capabilities and limits

    PS: Note to moderators, if this post is miss-categorized, pls rectify it.
  2. Viktor Zhivkov
    Viktor Zhivkov avatar
    324 posts

    Posted 06 Aug 2014 Link to this post

    Hello Bilal,

    You are describing a scenario that we have nice and tidy solution for - Artificial Types and Fields.
    This feature allows you extend your domain model during runtime and still enjoy the performance of normal relational tables and structures.
    The approach uses Code First approach (as we call it - Fluent Mapping).
    When defining extensions to types or even whole types Telerik Data Access will generate the appropriate mapping and relational definitions including SQL script to update your database on the fly to accommodate the changes.
    You can check our Data Access Samples Kit companion product which contains dedicated sample demonstrating working with Artificial Types and Fields.
    After downloading and installing the Samples Kit product look for the "Consuming Types Defined During Runtime" sample in Fluent Mapping category.

    Based on my previous experience in software development Artificial Types are easier to manage and perform better than most alternatives (like Entity-Attribute-Value pattern that you are describing).

    One was note - if you know that your object have weak typing and their schema is very dynamic you may consider switching to NoSQL persistence solution that will allow you to store whole objects rather than their strict relational representation.

    Viktor Zhivkov
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top