public static string GetNamespacesForForeignKeyList(IEnumerable <IEntityType> list, string nameSpaceString) { StringBuilder sb = new StringBuilder(); foreach (var item in list) { sb.AppendFormat("using {0}.{1}Classes;\n", nameSpaceString, EntityListFormatter.GetNakedNameOfIEntityType(item)); } return(sb.ToString()); }
public bool TryEvaluateFormat(IFormattingInfo formattingInfo) { var obj = formattingInfo.CurrentValue; var type = obj.GetType(); var foreignKey = (IForeignKey)type.GetProperty("ForeignKeyObject").GetValue(obj, null); var namespaceString = (string)type.GetProperty("Namespace").GetValue(obj, null); var nakedEntityName = EntityListFormatter.GetNakedNameOfIEntityType(foreignKey.DeclaringEntityType); formattingInfo.Write(string.Format("using {0}.{1}Classes", namespaceString, nakedEntityName)); return(true); }
public static string GetNameOfForeignKey(IForeignKey key) { var sb = new StringBuilder(); sb.Append(EntityListFormatter.GetNakedNameOfIEntityType(key.DeclaringEntityType)); foreach (var property in key.Properties) { sb.Append(PropertyListFormatter.GetNakedNameOfPropertyName(property)); } sb.Append("ForeignKey"); return(sb.ToString()); }