If you turn ADictionary into a plain IDictionary (the non-generic type) you
can use dynamic-component.

http://ayende.com/blog/3942/nhibernate-mapping-dynamic-component


2013/11/5 Pete Appleton <[email protected]>

> Is it possible to have just one entity in a session operating as a
> dynamic-map, all other entities being mapped as POCO's?  For example:
>
> <class name="SomeNamespace.SomePOCO, SomeAssembly" >
>         <id>...</id>
>         <property>...</property>
>         <many-to-one name="ADictionary" entity-name="ADictionary"
> ></many-to-one>
> </class>
>
> <class entity-name="ADictionary>
>         <id>...</id>
>         <property>...</property>
> </class>
>
> public class SomePOCO {
>         public virtual int Id { get; protected set; }
>         public virtual IDictionary<string,object> ADictionary { get;
> protected set; }
>         // etc
> }
>
> This is just R&D work at the moment, looking at different ways of
> storing key-value data pairs associated with an entity.  We've been
> using a normalised EAV-style approach so far but want to compare it with
> the denormalised "ultra wide table" approach for which a dynamic-map
> seems ideally suited.  A couple of attempts at this have produced some
> interesting exceptions such as "System.InvalidCastException: Unable to
> cast object of type 'NHibernate.Proxy.Map.MapProxy' to type
> 'System.Collections.Generic.IDictionary`2[System.String,System.Object]'"
> ; am I doing something wrong, or is this simply not a viable idea?
>
> Thanks,
> Pete
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to