Exemple #1
0
        protected override void EndProcessing()
        {
            MVAttributeQuery q = new MVAttributeQuery();

            q.Operator = this.Operator;
            q.Value    = this.Value;

            if (this.Value == null)
            {
                if (!(this.Operator == MVSearchFilterOperator.IsNotPresent || this.Operator == MVSearchFilterOperator.IsPresent))
                {
                    throw new ArgumentNullException("Value", "Value must be specified unless operator is IsPresent or IsNotPresent");
                }
            }

            DsmlAttribute attribute;

            if (!MiisController.Schema.Attributes.TryGetValue(this.Attribute, out attribute))
            {
                throw new ItemNotFoundException(string.Format("Attribute {0} does not exist", attribute));
            }

            q.Attribute = attribute;

            if (this.collectedObjects.Count > 0)
            {
                this.WriteObject(this.collectedObjects, true);
            }

            this.WriteObject(q);
        }
        private void GetByKey()
        {
            MVAttributeQuery a = new MVAttributeQuery();

            a.Attribute = this.GetAttribute();
            a.Operator  = MVSearchFilterOperator.Equals;
            a.Value     = this.Value;

            MVQuery q = new MVQuery();

            q.ObjectType = this.GetObjectType();
            q.QueryItems.Add(a);

            this.WriteObject(SyncServer.GetMVObjects(q), true);
        }
        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);
            }
        }