public void DoRefresh()
        {
            if (EntityNonScalarPropertiesIndex < 0)
            {
                return;
            }
            if (EntityNonScalarProperties.Count <= EntityNonScalarPropertiesIndex)
            {
                return;
            }
            if (SelectedEntity == null)
            {
                return;
            }
            if (SelectedEntity.CodeElementRef == null)
            {
                return;
            }
            string    navigationName = EntityNonScalarProperties[EntityNonScalarPropertiesIndex];
            CodeClass dbContext      = null;

            if (SelectedDbContext != null)
            {
                if (SelectedDbContext.CodeElementRef != null)
                {
                    dbContext = SelectedDbContext.CodeElementRef as CodeClass;
                }
            }
            List <FluentAPIForeignKey> frnKeys =
                (SelectedEntity.CodeElementRef as CodeClass).CollectForeignKeys(dbContext, new List <string> {
                navigationName
            });

            if (frnKeys == null)
            {
                ErrorsText = "No Fk detected";
                return;
            }
            if (frnKeys.Count < 1)
            {
                ErrorsText = "No Fk detected";
                return;
            }
            string className = (SelectedEntity.CodeElementRef as CodeClass).Name;

            if (frnKeys[0].HasErrors)
            {
                ErrorsText = frnKeys[0].ErrorsText;
            }
            else
            {
                ErrorsText = null;
            }
            IsCascadeOnDelete = frnKeys[0].IsCascadeDelete;
            if (frnKeys[0].EntityName == className)
            {
                string navName = frnKeys[0].InverseNavigationName;
                if (PrincipalNonScalarProperties != null)
                {
                    FluentAPINavigationProperty np = PrincipalNonScalarProperties.FirstOrDefault(p => p.PropName == navName);
                    if (np != null)
                    {
                        PrincipalNonScalarPropertiesIndex = PrincipalNonScalarProperties.IndexOf(np);
                    }
                    else
                    {
                        PrincipalNonScalarPropertiesIndex = -1;
                    }
                }

                ForeignKeyProperties.Clear();
                if ((frnKeys[0].ForeignKeyProps != null) && (EntityProperties != null))
                {
                    foreach (FluentAPIProperty itm in frnKeys[0].ForeignKeyProps)
                    {
                        FluentAPIExtendedProperty currItm =
                            EntityProperties.FirstOrDefault(i => i.PropName == itm.PropName);
                        if (currItm != null)
                        {
                            ForeignKeyProperties.Add(currItm);
                        }
                    }
                }
                ForeignKeyTypesIndex = ForeignKeyTypes.IndexOf(frnKeys[0].NavigationType);
            }
            else
            {
                PrincipalNonScalarPropertiesIndex = -1;
                ForeignKeyProperties.Clear();
            }
        }