Example #1
0
        private void LoadProperties()
        {
            try
            {
                var analyser = new CollectionPropertyAnalyser(
                    MongoUtilities.Create(_connection),
                    _database,
                    _collectionName);

                var props = analyser.GetAllProperties();

                _mainWindow.Dispatcher.Invoke(new Action(() => PopulateList(props)));
            }
            catch (Exception ex)
            {
                Utilities.LogException(ex);
            }
        }
Example #2
0
        private void ScanCollectionForProperties()
        {
            try
            {
                var analyser = new CollectionPropertyAnalyser(
                    MongoUtilities.Create(_cnn),
                    _databaseName,
                    _collectionName);

                _sortFieldsTemp.Clear();

                var allProperties = analyser.GetAllProperties();
                _sortFieldsTemp.AddRange(allProperties.Select(item => item.FullName).ToList());
                allProperties.ToList().ForEach(item =>
                    {
                        if (!_sortFieldsInfo.ContainsKey(item.FullName))
                        {
                            _sortFieldsInfo.Add(item.FullName, item.Type);
                        }
                    });

                _control.Dispatcher.Invoke(new Action(() => ShowScanResults()));
            }
            catch (Exception ex)
            {
                Utilities.LogException(ex);
            }
        }
Example #3
0
        private IEnumerable<MingTreeViewItem> LoadPropertyProperties(CollectionPropertyNode parent, ConnectionInfo cnnInfo)
        {
            IEnumerable<CollectionProperty> properties;
            try
            {
                var analyser = new CollectionPropertyAnalyser(MongoUtilities.Create(cnnInfo), parent.DatabaseName, parent.CollectionName);

                var parents = new List<string>();

                properties = analyser.GetProperties(parent.FullPath);
            }
            catch
            {
                return ReturnConnectionFailure();
            }

            var nodes = new List<MingTreeViewItem>();
            properties.ToList().ForEach(property =>
            {
                var hasChildren = property.Type == BsonType.Document || property.Type == BsonType.Array;
                nodes.Add(new MingTreeViewItem(Utilities.BitmapImageFromBitmap(hasChildren ? Properties.Resources.documents : Properties.Resources.document),
                    property.Name,
                    string.Format("({0})", property.Type.ToString().ToLower()),
                    new CollectionPropertyNode(parent.DatabaseName, parent.CollectionName, property.Name, string.Format("{0}.{1}", parent.FullPath, property.Name)), hasChildren));
            });
            return nodes;
        }