The problem is how to Map or Dynamic Map when the the columns inside the bag
are unknown, or how can I map a collection of unknown properties inside a
property bag of an entity?
in other explanation in Entity.cs I have:
public virtual IDictionary AdditionalFields { get; set; }(supposed to be my
additional unknown fields)
public virtual Info AdditionalFieldsInfo{get; set;}(another object which
has the information about AdditionalFields or unknown fields)
in mapping file I have:
<many-to-one name="AdditionalFieldsInfo"
class="Info"
/>
<dynamic-component name="AdditionalFields">
(The problem is here:The number of properties to be mapped are unknown and
also the column names and other spec.)
<property name=? type?>
<property name=? type?>
</dynamic-component>
So how can I map those fields dynamically?
Thanks.
On Mon, Jun 15, 2009 at 10:51 PM, Fabio Maulo <[email protected]> wrote:
> When I wrote Map I mean this map:
> http://nhforge.org/doc/nh/en/index.html#collections-mapping
>
> <http://nhforge.org/doc/nh/en/index.html#collections-mapping>You can use
> it as a name-value list.
>
> 2009/6/15 Silvia <[email protected]>
>
>
>> Yes, it would be a propertybag.The example that I mentioned is in
>> fluent nhibernate,but it is also fine for me to know how to fix it in
>> nhibernate xml mapping.The problem with component or dynamic component
>> is that I need to specify the properties which I do not know and I
>> will have the information at run time.That is why I need to map them
>> dynamically.
>> I also posted the same question in fluent nhibernate user group and
>> hope to get some answers in any of the groups.
>> Thanks.
>>
>>
>> On Jun 15, 1:40 pm, sima ganji <[email protected]> wrote:
>> > I explained the situation in my previous post.Any thought how to do this
>> > mapping?
>> >
>> >
>> >
>> > On Mon, Jun 15, 2009 at 12:41 PM, sima ganji <[email protected]>
>> wrote:
>> > > Something like this:
>> > > In Entity.cs I have this
>> > > public virtual IDictionary AdditionalFields { get; set; }
>> > > public virtual Info AdditionalFieldsInfo{get; set;}
>> >
>> > > In EntityMap.cs I have this
>> >
>> > > References(x => x.AdditionalFieldsInfo);
>> >
>> > > and I should have something like this:
>> >
>> > > DynamicComponent(x => x.AdditionalFields , m =>
>> >
>> > > {
>> >
>> > > m.Map(?I dont have the number of columns to be mapped and column
>> > > names.These information needs to come from AdditionalFieldsInfo);
>> >
>> > > });
>> >
>> > > Regards,
>> >
>> > > On Mon, Jun 15, 2009 at 12:10 PM, Fabio Maulo <[email protected]
>> >wrote:
>> >
>> > >> You mean that you have a ProperyBag ? You can persist a PropertyBag
>> using
>> > >> Map or Dynamic-Map how present the PropertyBag outside persistence
>> stuff is
>> > >> another matter.
>> >
>> > >> 2009/6/15 sima ganji <[email protected]>
>> >
>> > >> Thanks for your reply Fabio,but I am still not very sure how to
>> > >>> implement this.Could you please give me more explanation?
>> > >>> My main entity and it's mapping is there, but I have some more
>> fields
>> > >>> which I need to map them dynamically.
>> >
>> > >>> Regards,
>> >
>> > >>> On Sun, Jun 14, 2009 at 11:17 PM, Fabio Maulo <
>> [email protected]>wrote:
>> >
>> > >>>> Duck typing ? Possible:
>> > >>>>http://fabiomaulo.blogspot.com/2008/10/less-than-gof-is-hbm.html
>> >
>> > >>>> 2009/6/14 Silvia <[email protected]>
>> >
>> > >>>>> Here is the situation:
>> > >>>>> I am using fluent nhibernate with a legacy database. I need to map
>> > >>>>> some additional columns to a dictionary(?) property in my entity
>> > >>>>> dynamically, because I do not know the number of columns and
>> column
>> > >>>>> names and other specifications at compile time and I dynamically
>> need
>> > >>>>> to work with those columns(insert,update...).There is another
>> object
>> > >>>>> which has those information and has a relationship with my main
>> entity
>> > >>>>> based on the value of two other columns.Is this possible in
>> > >>>>> nhibernate?
>> > >>>>> I tried to use DynamicComponent but the problem is I don't know
>> what
>> > >>>>> would be the properties in my component.
>> > >>>>> I appreciate if someone could help.
>> > >>>>> Thanks
>> >
>> > >>>>> (similar problem here:
>> >
>> > >>>>>
>> http://stackoverflow.com/questions/672840/nhibernate-map-unknown-amou...
>> > >>>>> )
>> >
>> > >>>> --
>> > >>>> Fabio Maulo
>> >
>> > >> --
>> > >> Fabio Maulo- Hide quoted text -
>> >
>> > - Show quoted text -
>>
>>
>
>
> --
> Fabio Maulo
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---