Hello,

Nobody answered me.

So i changed my copy of mapping.attributes sources with a simple rule.


( Changed method:
NHibernate.Mapping.Attributes.HbmWriter.WriteComponent(System.Xml.XmlWriter
writer, System.Type type))

Rule: property.column of a component  = component.name+property.column

So the result is;

Simple1.aProperty's column name= Simple1aProperty
and
Simple2.aProperty's column name= Simple2aProperty

I know, it is a case specific solution. :(
I still waiting for a general solution with mapping.attributes, if exists.
:)


Thanks.
Fethi

17 Haziran 2009 21:47 tarihinde Fethi Gürcan <[email protected]> yazdı:

> Hello,
>
> i have simple component class like that;
>
>     [Component]
>     public class SimpleComponent
>     {
>         [Property(Column = "`aProperty`")]
>         public virtual double aProperty { get; set; }
>
>         [Property(Column = "`bProperty`")]
>         public virtual string bProperty { get; set; }
>     }
>
> i can use it in any entity class via [ComponentProperty] attribute;
>
> but if i want to use twice in same entity class like that;
>
>     [Class(Table = "`SomeTable`")]
>     public class SomeTable
>     {
>          ....
>
>         [ComponentProperty]
>         public virtual SimpleComponent Simple1 { get; set; }
>
>         [ComponentProperty]
>         public virtual SimpleComponent Simple2 { get; set; }
>     }
>
> the two component properties uses the same column names int the table
> offcourse...
>
>
>    - Firstly, i already know how to map this scenario in hbm.xml. (with
>    changing the column names in each component tag) But i don't know how to do
>    this via NHibernate.Mapping.Attributes.
>    - I dont know how to override the column names in the component.
>    (without overriding the component class :), if i do this there will be many
>    simple component sub classes, and it is also bad design )
>    - [AttributeIdentifier] seems good choice but it doesnt effect with
>    [ComponentProperty] on the property definition.
>    - [RawXML] seems ltest choice but, it writes custom xml data at start
>    of the entity class mapping before identity mapping definition. (it gives
>    error, and i dont know how to change position)
>    - I am using 2.0.1 GA (May be later versions can do this i dont know.)
>
>
> Can anybody help me about this problem?
>
> Thanks.
>
> --
> Fethi Gürcan
>



-- 
Fethi Gürcan

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