private static void BeforeBag(IModelInspector modelinspector, PropertyPath member, IBagPropertiesMapper propertycustomizer) { propertycustomizer.Key(x => x.Column(member.GetContainerEntity(modelinspector).Name + "Id")); propertycustomizer.Cascade(Cascade.All); propertycustomizer.Inverse(false); propertycustomizer.Lazy(CollectionLazy.NoLazy); }
public static void OneToManyConvention(IModelInspector modelInspector, PropertyPath member, IBagPropertiesMapper map) { var inv = member.LocalMember.GetInverseProperty(); if (inv == null) { map.Key(x => x.Column(member.GetContainerEntity(modelInspector).Name + "Id")); map.Cascade(Cascade.All | Cascade.DeleteOrphans); map.BatchSize(20); map.Inverse(true); } }
private void NameKeyColumn(IModelInspector modelinspector, PropertyPath member, IBagPropertiesMapper propertycustomizer) { var association = BidirectionAssociation.AnalyzeManyToOne(member); var columnName = association.IsBidirectional ? association.ColumnNameOnCollectionSide : member.GetRootMember().ReflectedType.Name + "Id"; propertycustomizer.Key(keyMapper => keyMapper.Column(columnName)); propertycustomizer.Inverse(association.IsBidirectional); }
void ApplyBagConvention(IModelInspector mi, PropertyPath type, IBagPropertiesMapper map) { map.Cascade(Cascade.All | Cascade.DeleteOrphans); map.Key(km => km.Column(type.LocalMember.DeclaringType.Name + "_id")); var bagType = type.LocalMember.GetPropertyOrFieldType().DetermineCollectionElementType(); var parentType = type.LocalMember.DeclaringType; if (bagType.HasPublicPropertyOf(parentType)) { map.Inverse(true); } }
private void ApplyBagConvention(IModelInspector mi, PropertyPath type, IBagPropertiesMapper map) { map.Cascade(Cascade.All | Cascade.DeleteOrphans); map.Key(km => km.Column(type.LocalMember.DeclaringType.Name + "_id")); }
public static void MapBag(IModelInspector modelInspector, PropertyPath member, IBagPropertiesMapper map) { var inv = member.LocalMember.GetInverseProperty(); if (inv == null) { map.Key(x => x.Column(member.GetContainerEntity(modelInspector).Name + "Id")); //map.Cascade(Cascade.All | Cascade.DeleteOrphans); map.BatchSize(20); map.Inverse(true); var elementType = member.LocalMember.GetPropertyOrFieldType().DetermineCollectionElementType(); var genericCollectionType = typeof(DomainListType <>); var collectionType = genericCollectionType.MakeGenericType(new[] { elementType }); map.Type(collectionType); } }
public void InvokeCustomizers(PropertyPath member, IBagPropertiesMapper mapper) { InvokeCustomizers(collectionCustomizers, member, mapper); InvokeCustomizers(bagCustomizers, member, mapper); }
protected virtual void OnBeforeMapBag(IModelInspector modelInspector, PropertyPath member, IBagPropertiesMapper propertyCustomizer) { }
public static void MapBagsWithCascadePersist(IModelInspector modelinspector, PropertyPath member, IBagPropertiesMapper propertycustomizer) { propertycustomizer.Cascade(Cascade.Persist); }
/// <summary> /// Applies any conventions to bag properties. /// </summary> /// <param name="mapper">The mapper.</param> /// <param name="member"> </param> protected virtual void ApplyBagConventions(IBagPropertiesMapper mapper, PropertyPath member) { mapper.Inverse(true); }
protected virtual void OnAfterMapBag(IModelInspector modelInspector, PropertyPath member, IBagPropertiesMapper propertyCustomizer) { }
private static void MapperOnBeforeMapBag(IModelInspector insp, PropertyPath prop, IBagPropertiesMapper map) { map.Key(km => km.Column(prop.GetContainerEntity(insp).Name + "Id")); map.Cascade(Cascade.All); }
private static void MapBag(IModelInspector modelinspector, PropertyPath member, IBagPropertiesMapper bag) { bag.Key(key => { string keyColumnName = string.Format("{0}Id", member.LocalMember.ReflectedType.Name); key.Column(keyColumnName); string foreignKey = string.Format("FK_{0}__{1}__{2}", member.LocalMember.ReflectedType.Name, member.LocalMember.Name, keyColumnName); key.ForeignKey(foreignKey); }); bag.Fetch(CollectionFetchMode.Subselect); bag.Cascade(Cascade.Persist); bag.Inverse(true); }