Esempio n. 1
0
        /// <summary>
        /// Executes the strongly-typed query represented by a specified expression tree.
        /// </summary>
        /// <returns>
        /// The value that results from executing the specified query.
        /// </returns>
        /// <param name="entry"></param>
        /// <param name="expression">An expression tree that represents a LINQ query.</param><typeparam name="TResult">The type of the value that results from executing the query.</typeparam>
        public virtual TResult Execute <TResult>(EntryObject entry, Expression expression)
        {
            var queryState          = new EntryQueryState(Context, typeof(TResult), expression);
            var directoryExpression = queryState.GetSingleResultExpression();

            return(Context.QueryExecutor.Execute <TResult>(entry.Entry, _scope, directoryExpression));
        }
Esempio n. 2
0
        public EntrySetCollection(EntryObject entryObject, PropertyInfo property) : base(entryObject.Context)
        {
            _entryObject = entryObject;
            _property    = property;

            var attribute = _property.GetAttribute <EntryCollectionPropertyAttribute>();

            if (attribute != null)
            {
                _scope = attribute.Scope;
            }
        }
Esempio n. 3
0
        public void SetParent(EntryObject parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            if (Parent == parent)
            {
                return;
            }

            Parent = parent;
            //SetParent(GetCnValue(), parent);
        }
Esempio n. 4
0
        public bool Add(EntryObject obj)
        {
            if (obj != null && obj.Entry != null)
            {
                var addUserResult = Entry.Invoke("Add", obj.Entry.Path);
                var result        = addUserResult == null;

                if (!result)
                {
                    Marshal.ReleaseComObject(addUserResult);
                }

                return(result);
            }

            return(false);
        }
Esempio n. 5
0
        public bool Remove(EntryObject obj)
        {
            if (obj != null && obj.Entry != null)
            {
                var removeUserResult = Entry.Invoke("Remove", obj.Entry.Path);
                var result           = removeUserResult == null;

                if (!result)
                {
                    Marshal.ReleaseComObject(removeUserResult);
                }

                return(result);
            }

            return(false);
        }
Esempio n. 6
0
 public EntrySetCollection(EntryObject entryObject, PropertyInfo property) : base(entryObject.Context)
 {
     _entryObject = entryObject;
     _property    = property;
 }
Esempio n. 7
0
 public EntrySetCollectionQueryState(DirectoryContext context, EntryObject entry, SearchScope scope, Type entryType, Expression expression) : base(context, entryType, expression)
 {
     Scope       = scope;
     EntryObject = entry;
 }
Esempio n. 8
0
 public EntryCollection(EntryObject entryObject, PropertyInfo property)
 {
     _entryObject = entryObject;
     _property    = property;
 }
Esempio n. 9
0
 /// <summary>
 /// Constructs an <see cref="T:System.Linq.IQueryable`1"/> object that can evaluate the query represented by a specified expression tree.
 /// </summary>
 /// <returns>
 /// An <see cref="T:System.Linq.IQueryable`1"/> that can evaluate the query represented by the specified expression tree.
 /// </returns>
 /// <param name="entry">The <see cref="EntryObject"/> to use as the root.</param>
 /// <param name="expression">An expression tree that represents a LINQ query.</param><typeparam name="TElement">The type of the elements of the <see cref="T:System.Linq.IQueryable`1"/> that is returned.</typeparam>
 public virtual IQueryable <TElement> CreateQuery <TElement>(EntryObject entry, Expression expression)
 {
     return(new EntryQuery <TElement>(new EntrySetCollectionQueryState(Context, _entry, _scope, typeof(TElement), expression)));
 }
Esempio n. 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entry"></param>
 /// <param name="scope"></param>
 /// <param name="context"></param>
 public EntrySetCollectionQueryProvider(EntryObject entry, SearchScope scope, DirectoryContext context) : base(context)
 {
     _entry = entry;
     _scope = scope;
 }
Esempio n. 11
0
		/// <summary>
		/// Initializes a new instance of the <see cref="EntryReference{TEntry}"/> class.
		/// </summary>
		/// <param name="entryObject">The entry object.</param>
		/// <param name="property">The property of the parent <see cref="EntryObject"/>.</param>
		public EntryReference(EntryObject entryObject, PropertyInfo property)
		{
			_entryObject = entryObject;
			_property = property;
		}