Exemplo n.º 1
0
        public void OnForeignKeySelected(ModelViewForeignKey foreignKey)
        {
            if (ModelViews == null)
            {
                ModelViews = new ObservableCollection <ModelViewSerializable>();
            }
            if (foreignKey == null)
            {
                ModelViews.Clear();
                return;
            }
            if (ModelViews.Any(mv => ((mv.RootEntityFullClassName != foreignKey.NavigationEntityFullName) || (mv.RootEntityUniqueProjectName != foreignKey.NavigationEntityUniqueProjectName))))
            {
                ModelViews.Clear();
            }
            if (CurrentDbContext == null)
            {
                return;
            }
            if (CurrentDbContext.ModelViews == null)
            {
                return;
            }
            List <ModelViewSerializable> result = CurrentDbContext.ModelViews
                                                  .Where(mv => (mv.RootEntityFullClassName == foreignKey.NavigationEntityFullName) && (mv.RootEntityUniqueProjectName == foreignKey.NavigationEntityUniqueProjectName))
                                                  .ToList();

            if (result != null)
            {
                if (result.Count != ModelViews.Count)
                {
                    result.ForEach(r =>
                    {
                        if (!ModelViews.Any(mv => mv.ViewName == r.ViewName))
                        {
                            ModelViews.Add(r);
                        }
                    });
                }
            }
        }
 public void OnSelectedEntityChanged()
 {
     SelectedModel = null;
     ModelViews.Clear();
 }
 public void OnCurrentDbContextChanged()
 {
     SelectedModel = null;
     ModelViews.Clear();
 }