tags:

views:

34

answers:

1

I have design question. I have entity such as "Person". Person has properties such as: FirstName, LastName, Gender, BirthDate, .... End user when create a person in application may be need to define another property that is not defined in database table schema (or class person). for example: end user nead to define "property1" that its a string property. or nead define "proerty2" that its a image, or need define "property3" that its complex type.

please separate your design solution in tow level: 1-database table design
2-class design

thechnology: .NET Framework, SQL Server, WCF (All entity must be serializ over wire, special complec data in extended properties)
thank u.

A: 

Here's a starter for you, although more information would be helpful, such as what platform you're working in.

You could try a value/key pair approach, although you'll need to extend this futher so that you can assign different values to different entity instances.

In your database you might have a table with:

  • Unique row id
  • Entity id
  • property key
  • property value

If you're going to reuse this for other entity types you'll need an additional column to keep those types seperated.

If you're working in .Net you can design interfaces that decribe certain properties you want to work with at the API level.

You might access the properties in the database via a class which serves as a "property utility", this would be used internally by the entity, or the factory that creates them.

Adrian K
its very general. how can store complex data and serialize it over wire?
mmtemporary
Adrian K