This may be a very simple question. I am running on Build# 650 of
FluentNHibernate.

I am trying to set the Address component below as Unique key.

public class Employee
{
   [DomainSignature]
   public Address MailingAddress { get; set;}
 ...
 ....
}

public class Address
{
    public string Street { get; set;}
    public string City { get; set; }
}

I am trying to use IComponentConvention to do this and here is what I
am doing:

public class ComponentConvention : IComponentConvention
        {
                public void Apply(IComponentInstance instance)
                {
                        if (Attribute.IsDefined(instance.Property.MemberInfo,
typeof(NaturalKeyAttribute)))
                        {
                                foreach (var property in instance.Properties)
                                {
                                        property.UniqueKey("NaturalKey");
                                }
                        }
                }
        }

The problem is when I run the Mapping tests on Employee , I don't see
the code entering ComponentConvention at all, so hence it is never
translated as Unique keys in the database table.

On the other hand, if I use an older build (Build# 633), I get the
code to enter ComponentConvention, but it doesn't have a settable
UniqueKey.

Am I doing something wrong here or is there a different approach to
solve this problem.

Thanks,
sks




-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to