473,729 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB Design / Custom Attributes

I apologize ahead of time for the long post...

Background:
Working on a CRM type custom application. The application is for an
event management company. The company will provide the application for
other organizations to manage their own events. The events include
conferences, corp meetings, sales meetings, etc...
An event planner will define what information is needed for an attendee
to register for an event. We will be providing a standard list of
attributes for the event planner to select from. This list includes
personal information (name, address, phone numbers), air travel
information (preferred carriers, departure airports, etc...), hotel
information, etc...we've included all of the information available to
us from the business's previous experience. As far as the database
goes, all of the standard information given to use will be normalized.

The problem is each event may have unique information that needs to be
collected that is not part of the standard list of attributes. For
example, if McBurgers is planning an event, the event planner may want
to collect an attendee's McBurger employee code.

Depending on the uniqueness of the event, there may be up to 200 unique
attributes defined for it. This number comes from researching events
planned in the last 5 years. The number of attendees for an event range
from 100 to 10,000. The company expects about 3000 events per year.

Database Design
I've done a fair amount of research and found a couple of options to
meet our requirements, more specifically the need for event planners to
define custom attributes for an event.

1-)DynamicColumns :
Add an Event specific custom attributes table. The table would look
something like this:

Event_McBurger0 5
AttendeeID | McBurgerEmploye eCode | HiredDate | SomeOtherAttrib ute
-
bz@bz.com | AxEt356 | 01/01/2004 | Other val 2

2-)EAV:
Add an EAV (entity, attribute, value) table. The table would look
something like this:

Event_Attribute s
EventCode | AttendeeID | Attribute | Value
-
McBurger05 | ab*@abc.com | McBurgerEmploye eCode | AxEt356
McBurger05 | ab*@abc.com | HiredDate | 01/01/2004
McBurger05 | ab*@abc.com | SomeOtherAttrib ute | Other val 2

The Value attribute would be a character (probably varchar) datatype.

3-)Stronger Typed EAV
Have an EAV table for each data type. The tables would look something
like this:

Event_CharAttri butes
EventCode | AttendeeID | Attribute | CharValue
-
McBurger05 | ab*@abc.com | McBurgerEmploye eCode | AxEt356
McBurger05 | ab*@abc.com | SomeOtherAttrib ute | Other val 2

Event_DateAttri butes
EventCode | AttendeeID | Attribute | CharValue
-
McBurger05 | ab*@abc.com | HiredDate | 01/01/2004

There would be one Event_[DataType]Attribute table for each of the
datatypes allowed.

Pros/Cons

1-)DynamicColumns

Pros:
-Data integrity can be enforced
-Simpler queries for reporting
-Clearer data model for understanding data stored

Cons:
-Row size limitation of 8k must be managed (probably need to add
another table if run out of room.
-Stored procedures for CRUD operations would need to dynamically
created OR
Need to use dynamic SQL on the database or application.
-Adding/Removing columns on the fly can be very error prone

2-)EAV
Pros
-Static CRUD stored procs
Cons
-No data integrity
-Complex queries for reporting
-Worse performance than option 1.
-Table can get BIG...fast.

3-)Stronger Typed EAV
Pros
-Static CRUD stored procs
-Better data type integrity than EAV
Cons
-Complex queries for reporting
-Worse performance than option 1
-Table can get BIG...fast.
If you are still reading this...thank you!

The Questions:

-Are there other options other than the 3 described above? Or are these
pretty much it with slight variants.

-Does anyone see any missing Pros/Cons for any of the options that
should be considered?

-Is there a "preferred" method for what I am trying to do?

I suspect this will come down to the lesser of three devils. Just
trying to figure out which of the three it is.

We have prototyped the three options and are leaning towards option 1
and 3.

Any comments/suggestions are appreciated.

Thx

Aug 24 '05 #1
3 2884
Hi

What I have seen done in similar IT/CRM apps is the use of placeholder
columns.

i.e. in what you call the event table there would be on top of the
mandatory and key attributes, also ,say, 50 columns ,
custom1,custom2 ,custom3 .... custom50
they are all int type, and have a foreign key to another table:
table custom1values(i d int, value varchar)

you have another table, called column_usage indicating which of the
columns are being used and what are their logical names.

the only problem with this attitude is that the report query to fetch
the data cannot efficiently be a join, but rather is a query first to
see what columns are in use, and then a join query using only the
necessary tables.

By the way, I am not sure if this is in your requirement, but this
allows the users of the system to add/alter custom properties as the
system runs. you give them a ui that defines column names and update
the column_usage table.

hope this helps
Tzvika

Aug 24 '05 #2
Good alternative.

This falls somewhere in between options 1 and 3. I like the idea of not
having to create columns dynamically. It still suffers some of the same
issues as EAV though:

Pros:
-Static CRUD stored procs
-Better data type integrity than EAV
-Easier reporting than EAV (will have to get user defined attribute
name from a MetaData table however).

Cons:
-Column sizes are static (same with EAV)
-Can't enforce column constraints for an event (same with EAV)
-Can run out of custom attributes (which may be something we can live
with as long as we allocate enough "place holders"...but at up to 200
custom attributes, that may be quite a few place holders).

Thanks for the input...really apreciate it.
Thx Tzvika.

Aug 25 '05 #3
I am "moving" this thread to the microsoft .public .sqlserver newsgroup
in hopes to get more replies...

Thx.

Aug 29 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3146
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit from it. During run time, using a static method, the class creates an instance of the derived class using the Activator class and returns it. This design pattern is very similar to the design pattern applied by the Assembly class. The twist is...
5
454
by: Doug Holland | last post by:
Often you see code where an empty interface is used to indicate something about the class that realizes it. In the .NET world this can be done with custom attributes too, so which is better: public class SomeClass : IEmptyInterface or
1
1499
by: Eric | last post by:
I have what should be a fairly simple design question. I usage of mySQL will revolve around a common group + user system. There can be multiple groups and each group will contain some subset of users. Each group will have a custom set of data whose values vary per user. So basically a sample structure might look like this: (some details intentionally left out)
8
3211
by: John Lee | last post by:
Hi, If I want to check permission on each public method of a web service, (assume the checking routine is ready to use and called AccessCheck) , one way of doing it is to call this AccessCheck on top of each public method, I want to implement it in different way but seems missing something - I want to develop a custom attribute, let's say SecurityCheckEnabledAttribute with only Yes/No parameter, then create a base class for all web...
3
2146
by: Edward Diener | last post by:
I understand the syntax of custom attributes, but I have no idea what they are supposed to do. Anyone care to give me a clue as to their functionality ?
0
1195
by: scpedicini | last post by:
Okay, I've been having a problem with custom design-time properties that has been driving me nuts for about a week. The control that I'm working on extends System.Windows.Forms.AxHost, but I'm unable to add any custom properties to the control. Eg, private string stringProp = null;
17
2710
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to ASP.net objects and write the code to make the page work (normally I do this as I go - can't do this...
4
2786
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying the MasterType directive on the aspx form. My master page will render a custom navigation menu and I'd like to put in the properties of which tab and sub tab to load and other misc style info in the aspx form that can be used by master page.
2
151
by: Tem | last post by:
I have 2 projects a classlibrary project and a windows forms project. the winform app calls the library to perform certain functions and returns the results. however i run into a problem where the method in the library class requires the windows forms app to do something then complete its tasks then returns the results to the win form app. Example:
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.