/// <summary> /// Gets the foreign key field name to use for a property. /// </summary> private string GetKeyColumnName(IModelInspector inspector, PropertyPath member) { var otherSideProperty = member.OneToManyOtherSideProperty(); if (inspector.IsOneToMany(member.LocalMember) && otherSideProperty != null) { return(otherSideProperty.Name + this._foreignKeyColumnSuffix); } return(member.GetRootMemberType().Name + this._foreignKeyColumnSuffix); }
/// <summary> /// Gets the object type names for a many to many relationship sorted alphabetically. /// </summary> private static IEnumerable <string> GetManyToManySidesNames(PropertyPath member) { yield return(member.GetRootMemberType().Name); yield return(member.GetCollectionElementType().Name); }
/// <summary> /// Called when [to many other side property]. /// </summary> /// <param name="member">The member.</param> /// <returns></returns> public static MemberInfo OneToManyOtherSideProperty(this PropertyPath member) { return(member.GetCollectionElementType().GetFirstPropertyOfType(member.GetRootMemberType())); }