//TODO: Faire en sorte que s'il n'y a pas de ImportingConstructor on prend le eager constructor - voir comme pour le controllers

        public RouteRepository(IReflectionContentManager contentManager, IDocumentSession documentSession,
                               IContentPublicationStateManager contentPublicationStateManager,
                               IContentPublicationDateTimeManager contentPublicationDateTimeManager)
        {
            _reflectionContentManager          = contentManager;
            _documentSession                   = documentSession;
            _contentPublicationStateManager    = contentPublicationStateManager;
            _contentPublicationDateTimeManager = contentPublicationDateTimeManager;
        }
 public ContentPublicationDateTimeManager(IContentPublicationStateManager contentPublicationStateManager,
                                          IDateTimeManager dateTimeManager)
 {
     _contentPublicationStateManager = contentPublicationStateManager;
     _dateTimeManager = dateTimeManager;
 }
Beispiel #3
0
        //http://ravendb.net/docs/faq/lucene-queries-examples?version=2
        //https://github.com/ravendb/ravendb/commit/721c50ea51ff7721928cca76de957e9f7d9e3786
        public static IDocumentQuery <T> AddContentManagementQueryTerms <T>(this IDocumentQuery <T> documentQuery, IContentPublicationStateManager contentPublicationStateManager, IContentPublicationDateTimeManager contentPublicationDateTimeManager)
        {
            if (contentPublicationStateManager.ContentPublicationStateIsDraft())
            {
                return(documentQuery.OrderBy("CreationDate").AndAlso().WhereEquals("PublicationCreationDate", null));
            }

            var dateTime = contentPublicationDateTimeManager.GetContentPublicationDateTime().Value;

            return(documentQuery.OrderByDescending("CreationDate").AndAlso()
                   .Not.WhereEquals("PublicationCreationDate", null)
                   .AndAlso().WhereGreaterThan("PublicationEndingDate", dateTime)
                   .AndAlso().WhereLessThanOrEqual("PublicationStartingDate", dateTime));
        }