Apologies if you're already clear on this point, but automapping and
conventions are two different things. Your mapping override example is
already a good example of doing it with automapping. Of course you don't
want to create an override for each of your entities, so as you guessed you
want a convention. Something like:

public class CreateDateReadOnlyConvention : IPropertyConvention,
IPropertyConventionAcceptance
{
  public void Apply(IPropertyInstance instance)
  {
     instance.ReadOnly();
  }

 public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
  {
     criteria.Expect(x => x.Name == "CreateDate");
  }
}


On Wed, Mar 17, 2010 at 3:08 AM, Rob# <robie...@gmail.com> wrote:

> Hi,
>
> I have CreateDate property in all of my entities and I would like the
> SQL server to insert the value for them.
>
> public class ContactMappingOverride : IAutoMappingOverride<Contact>
>    {
>        public void Override(AutoMapping<Contact> mapping)
>        {
>            mapping.Map(c => c.CreateDate).ReadOnly();
>        }
>    }
>
>  I know how to make them readonly overrides using Fluent mapping (code
> above)  but not sure how I could do it by auto mapping.  how would I
> do it using property convention?  Many thanks.
>
>
>
> --
> 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<fluent-nhibernate%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>

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