سؤال

I have a set of entities which all derive from ModelBase. This includes things like Id,CreatedOn,LastModified.

I want to be able to use DynamicUpdate with all the mappings. How do I do this?

I've tried, without success, adding .UseOverridesFromAssemblyOf<MyAutoMapOverrides>() where my override is simply:

public class MyAutoMapOverrides : IAutoMappingOverride<Model.ModelBase>
{
   public void Override(FluentNHibernate.Automapping.AutoMapping<Model.ModelBase> mapping)
   {
      mapping.DynamicUpdate();
   }
}
هل كانت مفيدة؟

المحلول

And 30 more minutes of searching turns up the answer: .Conventions.Add(FluentNHibernate.Conventions.Helpers.DynamicUpdate.AlwaysTrue())

This, however, breaks my event handlers that set LastModified and CreatedOn. Due to that, I'll probably just stick with updating all properties.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top