private DsmlAttribute GetAttribute()
        {
            DsmlObjectClass objectClass = this.GetObjectType();
            IReadOnlyDictionary <string, DsmlAttribute> attributesToSearch;

            if (objectClass != null)
            {
                attributesToSearch = objectClass.Attributes;
            }
            else
            {
                attributesToSearch = MiisController.Schema.Attributes;
            }

            DsmlAttribute attribute;

            if (attributesToSearch.TryGetValue(this.Attribute, out attribute))
            {
                return(attribute);
            }
            else
            {
                throw new ItemNotFoundException(string.Format("Attribute {0} does not exist{1}{2}", this.Attribute, this.ObjectType == null ? string.Empty : " on object type ", this.ObjectType ?? string.Empty));
            }
        }
Exemplo n.º 2
0
        private void GetByObjectType()
        {
            MVQuery q = new MVQuery();

            using (DsmlObjectClass objecttype = this.GetObjectType())
            {
                q.ObjectType = objecttype;
            }

            using (MVObjectCollection mvobjects = SyncServer.GetMVObjects(q)) {
                this.WriteObject(mvobjects, true);
            }
        }
Exemplo n.º 3
0
 protected override void ProcessRecord()
 {
     using (DsmlSchema schema = SyncServer.GetMVSchema())
     {
         if (string.IsNullOrWhiteSpace(this.ObjectType))
         {
             this.WriteObject(schema);
         }
         else
         {
             if (schema.ObjectClasses.ContainsKey(this.ObjectType))
             {
                 using (DsmlObjectClass objectclasses = schema.ObjectClasses[this.ObjectType])
                 {
                     this.WriteObject(objectclasses);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        private void GetByPipeLineQuery()
        {
            MVQuery q = new MVQuery();

            using (DsmlObjectClass objecttype = this.GetObjectType()) {
                q.ObjectType = objecttype;
            }

            if (this.collectedQueries.Count > 0)
            {
                foreach (var item in this.collectedQueries)
                {
                    q.QueryItems.Add(item);
                }
            }

            q.CollationOrder = this.Collation ?? q.CollationOrder;
            using (MVObjectCollection mvobjects = SyncServer.GetMVObjects(q)) {
                this.WriteObject(mvobjects, true);
            }
        }
Exemplo n.º 5
0
        private void GetByKey()
        {
            MVAttributeQuery a = new MVAttributeQuery();

            using (DsmlAttribute attr = this.GetAttribute()) {
                a.Attribute = attr;
                a.Operator  = MVSearchFilterOperator.Equals;
                a.Value     = this.Value;
            }

            MVQuery q = new MVQuery();

            using (DsmlObjectClass objecttype = this.GetObjectType()) {
                q.ObjectType = objecttype;
                q.QueryItems.Add(a);
            }

            using (MVObjectCollection mvobjects = SyncServer.GetMVObjects(q))
            {
                this.WriteObject(mvobjects, true);
            }
        }