Пример #1
0
        public object TranslateOne(TranslatorContext context)
        {
            var directorySearch = context.DirectorySearcher;
            var origionalType   = context.Expression.GetOrigionalType();

            directorySearch.Filter = Parse(context).ToString();

            if (context.Expression.NodeType.Is(DirectoryExpressionType.SingleResult))
            {
                var singleResultExpression = (SingleResultExpression)context.Expression;

                if (singleResultExpression.SingleResultType == SingleResultType.Count)
                {
                    return(((SearchResults)context.FindAll()).Count);
                }
            }

            return(ResultMapper.Map(origionalType, context.FindOne()));
        }
Пример #2
0
        public object TranslateOne(Type elementType, DirectorySearcher searcher)
        {
            var context = new TranslatorContext(searcher);

            return(ResultMapper.Map(elementType, context.FindOne()));
        }
Пример #3
0
        public T TranslateOne <T>(DirectorySearcher searcher)
        {
            var context = new TranslatorContext(searcher);

            return(ResultMapper.Map <T>(context.FindOne()));
        }