public IEnumerable <T> All <T>() where T : DomainObject
        {
            Class @class = this.classRepository.WithCode(typeof(T).Name);
            IEnumerable <Object> objects        = this.objectRepository.FilteredByClassId(@class.Id);
            ObjectDirector       objectDirector = new ObjectDirector(this.requestHandler);

            return(objects.Select(
                       o => {
                DomainObjectBuilder <T> objectBuilder = new DomainObjectBuilder <T>();

                objectDirector.ConstructObject(objectBuilder, o);
                return objectBuilder.Build();
            }
                       ));
        }
示例#2
0
        public IEnumerable <T> All <T>()
        {
            Class @class = this.GetValidatedClass <T>();
            IEnumerable <Object> objects        = this.objectRepository.FilteredByClassId(@class.Id);
            ObjectDirector       objectDirector = new ObjectDirector(this.requestHandler);

            return(objects.Select(
                       o =>
            {
                StronglyTypedObjectBuilder <T> stronglyTypedObjectBuilder = new StronglyTypedObjectBuilder <T>();

                objectDirector.ConstructObject(stronglyTypedObjectBuilder, o);
                return stronglyTypedObjectBuilder.Build();
            }
                       ));
        }
        public IEnumerable <T> All <T>(string filteringQuery = null, string sortingMemberCode = null, string sortingDirection = null, int?pagingSkip = null, int?pagingTake = null)
        {
            Class   @class = this.GetValidatedClass <T>();
            Culture frontendDefaultCulture = this.requestHandler.GetService <ICultureManager>().GetFrontendDefaultCulture();
            Params  @params = new ParamsFactory(this.requestHandler).Create(filteringQuery, @class.Id, sortingMemberCode, sortingDirection, pagingSkip, pagingTake);
            IEnumerable <SerializedObject> serializedObjects = this.serializedObjectRepository.FilteredByCultureIdAndClassId(
                frontendDefaultCulture.Id, @class.Id, @params
                );

            ObjectDirector objectDirector = new ObjectDirector(this.requestHandler);

            return(serializedObjects.Select(
                       so =>
            {
                StronglyTypedObjectBuilder <T> objectBuilder = new StronglyTypedObjectBuilder <T>();

                objectDirector.ConstructObject(objectBuilder, so);
                return objectBuilder.Build();
            }
                       ));
        }