public InformationServiceQuery(InformationServiceContext context, string queryString, PropertyBag parameters)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            if (queryString == null)
                throw new ArgumentNullException("queryString");

            this.context = context;
            this.queryString = queryString;
            this.parameters = parameters ?? new PropertyBag();

            if (context.Proxy != null)
                this.operationContextScope = new OperationContextScope(context.Proxy.ClientChannel);
        }
示例#2
0
        public IEnumerable <T> Query <T>(string swql) where T : new()
        {
            EnsureConnection();

            using (var context = new InformationServiceContext(_proxy))
                using (var serviceQuery = context.CreateQuery <T>(swql))
                {
                    var enumerator = serviceQuery.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        yield return(enumerator.Current);
                    }
                }
        }
 public InformationServiceQuery(InformationServiceContext context, string queryString)
     : this(context, queryString, null)
 {
 }