*ModifiedDate Property Convention
ModifiedDate Version Convention*

    public class ModifiedDatePropertyConvention :
IPropertyConvention,IPropertyConventionAcceptance
    {
        public void Apply(IPropertyInstance instance)
        {
            instance.Not.Insert();
        }

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

        }
    }

    public class ModifiedDateVersionConvention :
IVersionConvention,IVersionConventionAcceptance
    {
        public void Apply(IVersionInstance instance)
        {
            instance.Default(DateTime.Now);
        }

        public void Accept(IAcceptanceCriteria<IVersionInspector> criteria)
        {
            criteria.Expect(x => x.Name == "ModifiedDate");

        }
    }


On 16 March 2010 16:08, 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.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to