public void OnSelectedEntityChanged() { SelectedForeignKey = null; ForeignKeys.Clear(); if (SelectedEntity == null) { SelectedEntityCaption = ""; } else { SelectedEntityCaption = SelectedEntity.CodeElementFullName; } }
public void DoAnalise() { if (ForeignKeys.Count > 0) { CheckIsReady(); return; } if ((SelectedEntity == null) || (SelectedDbContext == null)) { SelectedForeignKey = null; ForeignKeys.Clear(); CheckIsReady(); return; } DoAnaliseEx(); }
public void DoAnaliseEx() { SelectedForeignKey = null; ForeignKeys.Clear(); if ((SelectedEntity == null) || (SelectedDbContext == null)) { CheckIsReady(); return; } List <FluentAPIForeignKey> result = (SelectedEntity.CodeElementRef as CodeClass).CollectForeignKeys(SelectedDbContext.CodeElementRef as CodeClass); if (result != null) { foreach (FluentAPIForeignKey itm in result) { ForeignKeys.Add(itm); } } CheckIsReady(); }
public void OnSelectedDbContextChanged() { SelectedForeignKey = null; ForeignKeys.Clear(); }
public static FluentAPIForeignKey DefineErrorFlag(this FluentAPIForeignKey foreignKey) { if (foreignKey == null) { return(foreignKey); } foreignKey.HasErrors = false; if (foreignKey.ForeignKeyProps == null) { foreignKey.HasErrors = true; if (!string.IsNullOrEmpty(foreignKey.ErrorsText)) { foreignKey.ErrorsText += "\r\n"; } foreignKey.ErrorsText += "Foreign Key Props is not set."; } else { if (foreignKey.ForeignKeyProps.Count < 1) { foreignKey.HasErrors = true; if (!string.IsNullOrEmpty(foreignKey.ErrorsText)) { foreignKey.ErrorsText += "\r\n"; } foreignKey.ErrorsText += "Foreign Key Props is not set."; } } if (foreignKey.PrincipalKeyProps == null) { foreignKey.HasErrors = true; if (!string.IsNullOrEmpty(foreignKey.ErrorsText)) { foreignKey.ErrorsText += "\r\n"; } foreignKey.ErrorsText += "Primary Key Props is not set."; } else { if (foreignKey.PrincipalKeyProps.Count < 1) { foreignKey.HasErrors = true; if (!string.IsNullOrEmpty(foreignKey.ErrorsText)) { foreignKey.ErrorsText += "\r\n"; } foreignKey.ErrorsText += "Primary Key Props is not set."; } else { foreignKey.ErrorsText += ""; } } if ((foreignKey.ForeignKeyProps != null) && (foreignKey.PrincipalKeyProps != null)) { if (foreignKey.ForeignKeyProps.Count != foreignKey.PrincipalKeyProps.Count) { foreignKey.HasErrors = true; if (!string.IsNullOrEmpty(foreignKey.ErrorsText)) { foreignKey.ErrorsText += "\r\n"; } foreignKey.ErrorsText += "Primary Key Props Count \r\nis not equal to \r\nForeign Key Props Count."; } } if (string.IsNullOrEmpty(foreignKey.InverseNavigationName)) { foreignKey.HasErrors = true; if (!string.IsNullOrEmpty(foreignKey.ErrorsText)) { foreignKey.ErrorsText += "\r\n"; } foreignKey.ErrorsText += "Inverse Navigation is not defined"; } if (foreignKey.NavigationType == NavigationTypeEnum.Unckown) { foreignKey.HasErrors = true; if (!string.IsNullOrEmpty(foreignKey.ErrorsText)) { foreignKey.ErrorsText += "\r\n"; } foreignKey.ErrorsText += "Navigation Type is not defined"; } return(foreignKey); }