Does anyone out there know how to do the following?

I would like to store values retrieved from the database with
NHibernate in a dictionary instead of using class properties. For
example, let's say we have a table Employee with three fields: Id,
FirstName, and LastName.

I would like to have a class as follows:


public class Employee
{
    private Int64 _id;

    public Int64 Id
    {
        get { return _id; }
        set { _id = value; }
    }
    private IDictionary<String, Object> _properties;
    public IDictionary<String, Object> Properties
    {
        get { return _properties; }
        set { _properties = value; }
    }
    public void AddProperty(String keyName, Object value)
    {
        _properties.Add(keyName, value);
    }

    public Object GetProperty(String keyName)
    {
        return _properties[keyName];
    }
}



Then, I would like for NHibernate, when retrieving/persisting the
data, to call methods (or some means) like AddProperty/GetProperty to
add the values for FirstName, LastName to the dictionary using the
column name as the key.

Is this possible? What I am trying to accomplish is providing a
generic class that doesn't need to be compiled everytime a property is
added.

Thanks-in-advance.

--~--~---------~--~----~------------~-------~--~----~
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