public AutoPersistenceModel Generate() { var mappings = new AutoPersistenceModel(); mappings.AddEntityAssembly(typeof(EventType).Assembly).Where(GetAutoMappingFilter); mappings.Conventions.Setup(GetConventions()); mappings.Setup(GetSetup()); mappings.IgnoreBase <Entity>(); mappings.IncludeBase <BasicUser>(); mappings.IncludeBase <Garment>(); mappings.IgnoreBase <ContentBase>(); mappings.IgnoreBase <ContentSectionBase>(); mappings.IgnoreBase(typeof(EntityWithTypedId <>)); mappings.UseOverridesFromAssemblyOf <AutoPersistenceModelGenerator>(); return(mappings); }
public static AutoPersistenceModel IncludeAppBases(this AutoPersistenceModel model) { foreach (Type baseType in TypeHelper.GetAllConcreteTypesAssignableFrom <MrCMSApp>() .Select(type => Activator.CreateInstance(type) as MrCMSApp) .SelectMany(app => app.BaseTypes)) { model.IncludeBase(baseType); } return(model); }
public void Alter(AutoPersistenceModel model) { // if any type has a property of this type // that is of a type (or has a collection of a type) // that is abstract // is not generic // and inherits from entity // and has inheritors in the domain // then include that type // foreach property in type foreach (var strategyType in Strategies()) { model.IncludeBase(strategyType); } }