コード例 #1
0
ファイル: DataService.cs プロジェクト: zaharvsb52/My.MLC.Wms
        public override JsStoreData LoadList(string entityType, int start, int limit, JsFilter[] filter, JsSorter[] sort, string structureName,
                                             JsWorkflowIdentity workflowIdentity, JsWorkflowInstanceIdentity workflowInstanceIdentity)
        {
            var structureDataProvider = StructureDataProviders[structureName];
            var loadListQuery         = QueryDeserializer.DeserializeListQuery(structureDataProvider.RecordStructure, start, limit, filter, sort);

            return(((IListDataLoader)structureDataProvider).LoadList(loadListQuery));
        }
コード例 #2
0
        private static IQueryable GetQueryable <TEntity>(DomainServiceDescription domainServiceDescription, ServiceQuery query)
        {
            if (query != null && query.QueryParts != null && query.QueryParts.Any())
            {
                IQueryable queryable = Enumerable.Empty <TEntity>().AsQueryable();
                return(QueryDeserializer.Deserialize(domainServiceDescription, queryable, query.QueryParts));
            }

            return(null);
        }
コード例 #3
0
        private static void AccessMember(Type entityType, string memberToAccess)
        {
            IQueryable <EntityWithExcludedMember> queryable = new EntityWithExcludedMember[0].AsQueryable();

            List <ServiceQueryPart> queryParts = new List <ServiceQueryPart>()
            {
                new ServiceQueryPart("where", String.Format("it.{0} == \"Whatever\"", memberToAccess))
            };

            ExceptionHelper.ExpectInvalidOperationException(delegate
            {
                QueryDeserializer.Deserialize(DomainServiceDescription.GetDescription(typeof(QueryDeserializerDomainService)), queryable, queryParts);
            }, string.Format(CultureInfo.CurrentCulture, System.Linq.Dynamic.Resource.UnknownPropertyOrField, memberToAccess, entityType.Name));
        }
コード例 #4
0
        public void TestConstructorAccessChecked()
        {
            IQueryable <EntityWithExcludedMember> queryable = new EntityWithExcludedMember[0].AsQueryable();

            List <ServiceQueryPart> queryParts = new List <ServiceQueryPart>()
            {
                new ServiceQueryPart("where", "it.Double.ToString() == String('a', 1000)")
            };

            ExceptionHelper.ExpectException <ParseException>(delegate
            {
                QueryDeserializer.Deserialize(DomainServiceDescription.GetDescription(typeof(QueryDeserializerDomainService)), queryable, queryParts);
            }, string.Format(CultureInfo.CurrentCulture, System.Linq.Dynamic.Resource.MethodsAreInaccessible + " (at index 24)", typeof(String).Name));
        }
コード例 #5
0
        public void TestExponents()
        {
            IQueryable <EntityWithExcludedMember> queryable = new EntityWithExcludedMember[] {
                new EntityWithExcludedMember()
                {
                    Key = 1, Double = 2E+2
                },
                new EntityWithExcludedMember()
                {
                    Key = 2, Double = 2E+3
                },
            }.AsQueryable();

            List <ServiceQueryPart> queryParts = new List <ServiceQueryPart>()
            {
                new ServiceQueryPart("where", "it.Double < 2.5E+2")
            };

            queryable = (IQueryable <EntityWithExcludedMember>)QueryDeserializer.Deserialize(DomainServiceDescription.GetDescription(typeof(QueryDeserializerDomainService)), queryable, queryParts);
            Assert.AreEqual(1, queryable.Count());
            Assert.AreEqual(1, queryable.Single().Key);
        }