Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7842241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:16:27+00:00 2026-06-02T16:16:27+00:00

looking for examples/tutorial for custom user fields, not via EAV EAV is going to

  • 0

looking for examples/tutorial for custom user fields, not via EAV

EAV is going to be problematic for various reasons such as performance

  • there are many base entities/tables with over 100000 records each
  • there will likely be over a dozen attributes
  • the records are to be displayed in a flat ui grid incl. custom fields so flattening them would be an issue while maintaining performance

Looking at enabling this via DDL where all custom fields would go into a matching table such as

<tablename>_custom_<userid>

and all user attributes would map to a column each and all their metadata stored in a metadata table

the retrieval would be simpler where the query would simply be

select  * 
from <tablename> A, tableName_custom_userid B 
where B.KeyField = A.KeyField --( perhaps using outer join, haven't gone that far yet )

Wondering if there are any gotchas down the road that i need to be aware of ?

of course any samples/pointers would be helpful to kickstart the effort

specifically would appreciate any advice on using DDL for Sql Server compact 4

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:16:29+00:00Added an answer on June 2, 2026 at 4:16 pm

    One technique I have seen used is to use a sort of ‘hard-coded’ EAV pattern. Don’t hang up! It worked well with the dataset sizes you were talking about and didn’t actually use EAV – it was only EAV-esque.

    The idea is to have a set of tables to store these custom attributes within it, with some triggers (described below) on them. The custom attributes tablesets store metadata about the attribute (what table it goes with, data type, constraints, etc). You can get very fancy with this but I did not haev the need.

    The triggers on your meta-tables are there to re-generate views that rollup base+extension into first class objects within the DB. So instead of table person + employee extension table, you have an employee view that includes both. When you drop a new value into the custom attributes tables, the triggers will re-roll the views and include the new stuff. If you wanted to go nuts, you could also have the triggers re-write stored procedures as well. Depending on how your mid-tier code is structured, you would still be forced to re-code some, however this would be the case anyway should you be applying rules that read the data.

    In testing, I found that for the relatively small # of records you’re talking about, performance was somewhat slower but followed roughly the same pattern of degradation (2x the number of records, ~2x as slow).

    — edits —

    How I saw it done, you had a table that represented your first class objects, so a row for ‘person’ and a row for ’employee,’ etc. We’ll call that FCO. Then you had a secondary table that stored what tables represented the FCO. We’ll call that Srcs.. For person, there would be one row, which is the person table. For Employee, there would be two rows, the person table and the Employee extension. There is a third table, called Attribs, which stores the columns from the tables that constitute the FCO. For simplicity, we’ll say Employee has ID, Name and Address, and Employee has Hire Date and Department, and obviously PersonID referring back to Person table. So, 2 rows in FCO table (person and employee), 3 rows in Src table, 8 rows in Attribs.

    The view, we’ll call it vw_Employee, selects PersonID, Name, Address, Hire Date, Department from the two tables. It is built by a SQL stored procedure we’ll call OnMetadataChange.

    This SP is fired (by trigger or batch process), and its purpose is to generate the CREATE VIEW statements. It will iterate through every First Class Object, collect which fields from which tables constitute the view, and will issue a CREATE statement based on that. So OnMetadataChange produces a DROP and CREATE for each view, it generates a dynamic SQL statement that is executed once per entry in FCO table. It is preferable to do this with Triggers but not necessary. Hopefully your FCO definitions won’t change too often, and when they do, there will probably be a code release as well. You can run your OnMetadataChange SP at that time.

    The end result is a 2-layer database. The views constitute the First Class Object layer, which is meaningful to the application. The application only uses views. The tables constitute the ‘physical’ layer, which the application shouldn’t care about. The meta-tables are essentially your mapping between the FCO layer and the physical layer. It takes some time to set it up, but it’s quite effective, and gives you many of the benefits of EAV, while at the same time giving you the concrete benefits of 3nf tables (indexability, etc).

    If you’d like I can throw some sample SQL out there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Q - looking for examples/tutorial of 5NF/or 6NF, pref for custom user fields, details
The tutorial shows some very basic examples of pattern matching, such as matching over
I was looking for ASP.net page life cycle events tutorial using examples. I saw
Looking at examples and tutorials for some MVC libraries for web development on the
I'm looking for a good example project/tutorial that show the Kiwi testing framework in
I have been looking at EasyMock and tutorials/examples around using it for Unit Testing
I have been looking at examples online, and tutorials, and I cannot find anything
I'm looking for an article or tutorial that gives an example of what an
I've been looking for a while to find a good tutorial with code example
Looking at examples about socket programming, we can see that some people use AF_INET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.