public bool Match(MemberInfo subject) { var propertyType = subject.GetPropertyOrFieldType(); Type many = propertyType.DetermineCollectionElementType(); Type one = subject.DeclaringType; if (many == null) { return(false); } if (one.Equals(many)) { // Circular references return(false); } CascadeOn?applyCascade = DomainInspector.ApplyCascade(one, subject, many); if (applyCascade.HasValue && !applyCascade.Value.Has(CascadeOn.DeleteOrphans) && !applyCascade.Value.Has(CascadeOn.Remove) && !applyCascade.Value.Has(CascadeOn.All)) { return(false); } if (!DomainInspector.IsEntity(many)) { return(false); } if (DomainInspector.IsTablePerClass(many) && !DomainInspector.IsRootEntity(many)) { return(false); } return(base.Match(new Relation(one, many))); }
public override bool Match(MemberInfo subject) { var relation = GetRelation(subject); if (relation == null || !DomainInspector.IsEntity(relation.To)) { return(false); } return(base.Match(subject)); }
protected virtual string GetColumnNameForRelation(PropertyPath subject) { var relation = GetRelation(subject.LocalMember); var fromMany = relation.From; if (!DomainInspector.IsEntity(fromMany)) { fromMany = subject.GetContainerEntity(DomainInspector); } var toMany = relation.To; var baseColumnName = toMany.GetPoidColumnName(); return(fromMany != toMany ? baseColumnName : string.Format("{0}_{1}", subject.ToColumnName("_"), baseColumnName)); }
protected virtual string GetColumnNameForRelation(PropertyPath subject) { var relation = GetRelation(subject.LocalMember); var fromMany = relation.From; if (!DomainInspector.IsEntity(fromMany)) { fromMany = subject.GetContainerEntity(DomainInspector); } var toMany = relation.To; var baseColumnName = toMany.Name + "Id"; if (fromMany != toMany) { return(baseColumnName); } return(subject.ToColumnName() + baseColumnName); }
public override bool Match(MemberInfo subject) { if (!base.Match(subject)) { return(false); } var concreteRelation = GetConcreteRelation(subject); if (concreteRelation == null) { return(false); } var one = concreteRelation.From; var many = concreteRelation.To; if (one.Equals(many)) { // Circular references return(false); } Cascade?applyCascade = GetExplicitPolymorphismCascade(subject); if (applyCascade.HasValue && !applyCascade.Value.Has(Cascade.DeleteOrphans) && !applyCascade.Value.Has(Cascade.Remove) && !applyCascade.Value.Has(Cascade.All)) { return(false); } if (!DomainInspector.IsEntity(many)) { return(false); } if (DomainInspector.IsTablePerClass(many) && !DomainInspector.IsRootEntity(many)) { return(false); } return(true); }