コード例 #1
0
        private void RectangleDrop(object sender, DragEventArgs e)
        {
            var property = (string)e.Data.GetData(DataFormats.StringFormat);

            var desc = new IndexDescriptor();
            desc.IndexedProperties.Add(new IndexDescriptorProperty { PropertyName = property });
            AddIndex(desc);
        }
コード例 #2
0
ファイル: ManageIndexes.cs プロジェクト: stevehjohn/Hub
        private void PopulateList(IEnumerable<CollectionProperty> properties)
        {
            properties.ToList().ForEach(
                prop =>
                    _properties.Add(prop.FullName));

            var idxs = MongoUtilities.Create(_connection).GetDatabase(_database).GetCollection(_collectionName).GetIndexes();

            foreach (var idx in idxs)
            {
                var descriptor = new IndexDescriptor { IsSparse = idx.IsSparse, IsUnique = idx.IsUnique };

                var names = idx.Key.Names.ToArray();
                for (int i = 0; i < names.Length; i++)
                {
                    if (names[i] == "_id" && names.Length == 1)
                    {
                        continue;
                    }

                    var prop = new IndexDescriptorProperty { PropertyName = names[i] };
                    if (idx.Key[i].BsonType == MongoDB.Bson.BsonType.String)
                    {
                        prop.IndexType = IndexType.Geospatial;
                    }
                    else
                    {
                        if (idx.Key[i].ToInt32() > 0)
                        {
                            prop.IndexType = IndexType.Ascending;
                        }
                        else
                        {
                            prop.IndexType = IndexType.Descending;
                        }
                    }
                    descriptor.IndexedProperties.Add(prop);
                }

                if (descriptor.IndexedProperties.Count > 0)
                {
                    _dialog.IndexList.AddIndex(descriptor);
                }
            }
        }
コード例 #3
0
 public void AddIndex(IndexDescriptor index)
 {
     index.Id = _nextId++;
     _indexes.Add(index);
 }