Exemplo n.º 1
0
 public ODataServiceQuery(
     IODataServiceMetadata metadata,
     IODataServiceContext queryContext)
 {
     this._metadata     = metadata;
     this._queryContext = queryContext;
 }
Exemplo n.º 2
0
 protected NHibernateAbstractVisitor(ICriteria contentItemVersionRecordCriteria, IODataServiceMetadata metadata)
     : base()
 {
     this.contentItemVersionRecordCriteria = contentItemVersionRecordCriteria;
     this.contentItemRecordCriteria        = contentItemVersionRecordCriteria.BindCriteriaByPath("ContentItemRecord");
     this.metadata = metadata;
 }
Exemplo n.º 3
0
        public ODataService(
            IODataServiceMetadata oDataServiceMetadata,
            IODataServiceQuery oDataServiceQuery)
        {
            this._oDataServiceMetadata = oDataServiceMetadata;
            this._oDataServiceQuery    = oDataServiceQuery;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;
        }
 internal NHibernateCriterionVisitor(ICriteria contentItemVersionRecordCriteria, FilterClause filterClause, IODataServiceMetadata metadata)
     : base(contentItemVersionRecordCriteria, metadata)
 {
     this.filterClause                  = filterClause;
     this.projectionVisitor             = new NHibernateProjectionVisitor(contentItemVersionRecordCriteria, filterClause, metadata);
     this.criterionMethodVisitorFactory = new Dictionary <string, Func <IEnumerable <QueryNode>, ICriterion> >()
     {
         { "substring", this.SubStringOfMethod },
         { "startswith", this.StartsWithMethod },
         { "endswith", this.EndsWithMethod },
     };
 }
        internal static ICriteria OrderContentQuery(this ICriteria criteria, OrderByClause orderByClause, IODataServiceMetadata metadata)
        {
            if (null == orderByClause)
            {
                return(criteria);
            }

            var projectionVisitor = new NHibernateProjectionVisitor(criteria, orderByClause, metadata);
            var projection        = projectionVisitor.Visit(orderByClause.Expression);

            if (null != projection && orderByClause.Direction == OrderByDirection.Ascending)
            {
                criteria.AddOrder(Order.Asc(projection));
            }

            if (null != projection && orderByClause.Direction == OrderByDirection.Descending)
            {
                criteria.AddOrder(Order.Desc(projection));
            }

            return(criteria.OrderContentQuery(orderByClause.ThenBy, metadata));
        }
        internal static ICriteria FilterContentQuery(this ICriteria criteria, FilterClause filterClause, IODataServiceMetadata metadata)
        {
            var criterionVisitor = new NHibernateCriterionVisitor(criteria, filterClause, metadata);
            var criterion        = criterionVisitor.Visit(filterClause.Expression);

            if (null != criterion)
            {
                criteria.Add(criterion);
            }
            return(criteria);
        }
Exemplo n.º 7
0
 internal NHibernateProjectionVisitor(ICriteria contentItemVersionRecordCriteria, FilterClause filterClause, IODataServiceMetadata metadata)
     : this(contentItemVersionRecordCriteria, metadata)
 {
     this.filterClause = filterClause;
 }
Exemplo n.º 8
0
 internal NHibernateProjectionVisitor(ICriteria contentItemVersionRecordCriteria, OrderByClause orderByClause, IODataServiceMetadata metadata)
     : this(contentItemVersionRecordCriteria, metadata)
 {
     this.orderByClause = orderByClause;
 }
Exemplo n.º 9
0
 private NHibernateProjectionVisitor(ICriteria contentItemVersionRecordCriteria, IODataServiceMetadata metadata)
     : base(contentItemVersionRecordCriteria, metadata)
 {
     this.projectionMethodVisitorFactory = new Dictionary <string, Func <IEnumerable <QueryNode>, IProjection> >()
     {
         { "substring", this.SubStringOfMethod },
         { "concat", this.ConcatMethod },
         { "length", this.LengthMethod },
         { "replace", this.ReplaceMethod },
         { "toupper", this.ToUpperMethod },
         { "tolower", this.ToLowerMethod },
         { "trim", this.TrimMethod },
         { "indexof", this.IndexOfMethod },
         { "ceiling", this.CeilingMethod },
         { "floor", this.FloorMethod },
         { "round", this.RoundMethod },
         { "cast", this.CastMethod },
         { "year", this.YearMethod },
         { "month", this.MonthMethod },
         { "day", this.DayMethod },
         { "minute", this.MinuteMethod },
         { "second", this.SecondMethod },
     };
 }