/// <summary> /// Called when an empty fluent configuration object has been created, /// before applying any default Boying config settings (alterations, conventions etc.). /// </summary> /// <param name="cfg">Empty fluent NH configuration object.</param> /// <param name="defaultModel">Default persistence model that is about to be used.</param> public override void Created(FluentConfiguration cfg, AutoPersistenceModel defaultModel) { defaultModel.OverrideAll(map => { map.IgnoreProperties(x => x.MemberInfo.IsDefined(typeof(DoNotMapAttribute), false)); }); }
public AutoPersistenceModel Generate() { var mappings = new AutoPersistenceModel(); mappings = AutoMap.AssemblyOf<Domain.Entity>(); mappings.Where(GetAutoMappingFilter); mappings.Conventions.Setup(GetConventions()); mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>(); mappings.Setup(GetSetup()); mappings.OverrideAll(x => x.IgnoreProperties(z => z.PropertyType.IsSubclassOf(typeof(Enumeration)))); mappings.IgnoreBase<Domain.Entity>(); mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>(); return mappings; }
public void Alter(AutoPersistenceModel model) { model.OverrideAll(mapping => { var recordType = mapping.GetType().GetGenericArguments().Single(); if (Utility.IsPartRecord(recordType)) { var type = typeof(ContentPartAlterationInternal <>).MakeGenericType(recordType); var alteration = (IAlteration)Activator.CreateInstance(type); alteration.Override(mapping); } else if (Utility.IsPartVersionRecord(recordType)) { var type = typeof(ContentPartVersionAlterationInternal <>).MakeGenericType(recordType); var alteration = (IAlteration)Activator.CreateInstance(type); alteration.Override(mapping); } }); }
/// <summary> /// Called when an empty fluent configuration object has been created, /// before applying any default Orchard config settings (alterations, conventions etc.). /// </summary> /// <param name="cfg">Empty fluent NH configuration object.</param> /// <param name="defaultModel">Default persistence model that is about to be used.</param> public override void Created(FluentConfiguration cfg, AutoPersistenceModel defaultModel) { defaultModel.OverrideAll(map => { map.IgnoreProperties(x => x.MemberInfo.IsDefined(typeof(DoNotMapAttribute), false)); }); }