I think Jason is right, a map will be convenient.

and for :

- StringVal
- DateTimeVal
- IntVal
- DecimalVal

You could use an ICompositeUserType or something like that...?

2011/1/10 Jason Meckley <[email protected]>

> You will probably want to use Map (http://ayende.com/Blog/archive/
> 2009/06/03/nhibernate-mapping-ndash-ltmapgt.aspx). You could
> encapsulate this within the entity itself so you don't need to expose
> the dictionary.
>
> On Jan 10, 9:57 am, HDude <[email protected]> wrote:
> > I am coming on to a new project that uses NHibernate and has the
> > requirement that customers can add random properties to a POCO at
> > runtime.  The values would be stored as key-value pairs in a related
> > table.  I can't use dynamic-components because the database schema
> > can't be allowed to change when new fields are added by the client.
> > I've thought about exploring tuplizers but there don't seem to be too
> > many examples out in the wild.  Here is a sample schema:
> >
> > User
> > - ID (GUID)
> > - UserName (varchar 50)
> >
> > UserAdditionalValues
> > - ID (GUID) - links back to the ID in user
> > - FieldID (GUID) - links back to a table that stores fieldname, type,
> > validations, etc.
> > - StringVal
> > - DateTimeVal
> > - IntVal
> > - DecimalVal
> > etc..
> >
> > Each value would be placed into its appropriate VAL field.  1 user can
> > obviously have multiple additionalvalue fields (rows) and these have
> > to be flattened out to the corresponding row in the User table.
> >
> > Anyone have any suggestions?
> >
> > Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to