コード例 #1
0
        private IList <T> InnerDoQuery(RestrictionBuilderBase restrictionBuilder, OrderByBuilder orderByBuilder, int max, int skip)
        {
            ArchiveExecutionContext executionContext = _archiveExecutionContextProvider.Get();

            if (executionContext == null)
            {
                throw new InvalidOperationException(nameof(executionContext) + " not set, cannot be null");
            }

            ArchiveQueryParameters context = new ArchiveQueryParameters();

            context.ArchiveName      = executionContext.ArchiveName;
            context.Entities         = executionContext.Entities;
            context.RequestedColumns = DynamicPropertyHelper.GetAllDbColumnsPrefixed <T>();
            int page = 0;

            if (skip > 0)
            {
                page = SetPageSizeAndGetPage(skip, max, context);
            }
            if (restrictionBuilder != null)
            {
                context.Restrictions = restrictionBuilder.GetRestrictions();
            }
            if (orderByBuilder != null)
            {
                context.OrderBy = orderByBuilder.Get();
            }

            return(_resultParser.Parse <T>(executionContext, _executor.GetItems(context, max, page)));
        }
コード例 #2
0
        public void TestGetAllDbColumnsPrefixed()
        {
            IList <string> results = DynamicPropertyHelper.GetAllDbColumnsPrefixed <PropertyHelperTestCompany>();

            Assert.NotEmpty(results);
            Assert.Equal(3, results.Count);
            Assert.Equal("testcompany.id", results[0]);
            Assert.Equal("testcompany.name", results[1]);
            Assert.Equal("testcompany.activated", results[2]);
        }