Is it possible to do this on an interface?

For example I have the following mapping:

public class BodyMapping : ComponentMapping<IBody> {
        public BodyMapping() {
            Class<Body>();
            Property("_dummyFieldToLoadEmptyComponent", m => {
                m.Access(Accessor.Field);
                m.Formula("1");
                m.Access(Accessor.ReadOnly);
            });
            Property(x => x.Content);
        }
    }

However this throws the error: "NHibernate.MappingException: 'Member not 
found. The member '_dummyFieldToLoadEmptyComponent' does not exists in type 
IBody'".
On Wednesday, 1 May 2013 at 19:54:59 UTC+1 Ricardo Peres wrote:

> Yes it is, but you're doing it wrong, using the method overloads that take 
> delegates instead of those that take strings:
>
> this.Bag("privatefieldtomap",
>                     map =>
>                         {
>                             map.Access(Access.Field);
>                             map.Table("table");
>                             map.Key(k => k.Column("foreignkey"));
>                         },
>                     r => r.Element(m => m.Column("columntomap")));
>
> Notice the first parameter of the Bag method.
>
> RP
>
>
> On Wednesday, May 1, 2013 11:58:37 AM UTC+1, sturdytree wrote:
>>
>> e.g.
>>
>>     this.Bag(
>>                     r => "privatefieldtomap",
>>                     map =>
>>                         {
>>                             map.Access(Access.Field);
>>                             map.Table("table");
>>                             map.Key(k => k.Column("foreignkey"));
>>                         },
>>                     r => r.Element(m => m.Column("columntomap")));
>>
>>     public SomeType()
>>             {
>>                 this.Id(p => "privateidfield", Access(Access.Field));
>>                 this.Table("SomeTable");
>>                 this.Property(p => p.SomeProperty);
>>             }
>>
>> both throw an exception "expression expected; constant found"
>>
>> We could do this using xml mapping.
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/nhusers/41ce62c7-54b8-4343-9137-e8a256bfce31n%40googlegroups.com.

Reply via email to