public void Find(string domainObject, [FromQuery(Name = "order")] string order = null)
        {
            var request  = HttpContext.Request;
            var response = HttpContext.Response;
            var type     = Utility.CheckIdentifiable(DomainModel, domainObject, response);

            if (type.IsFailure)
            {
                return;
            }
            var uris = Serialization.TryDeserialize <string[]>(request, response);

            if (uris.IsFailure)
            {
                return;
            }

            Converter.PassThrough <GetDomainObject, GetDomainObject.Argument>(
                HttpContext,
                new GetDomainObject.Argument
            {
                Name       = domainObject,
                Uri        = uris.Result,
                MatchOrder = order == "match"
            });
        }
Beispiel #2
0
        public Task Find(string domainObject, HttpContext context)
        {
            var request  = context.Request;
            var response = context.Response;
            var order    = request.Query.ContainsKey("order") ? request.Query["order"][0] : null;

            var type = Utility.CheckIdentifiable(DomainModel, domainObject, response);

            if (type.IsFailure)
            {
                return(Task.CompletedTask);
            }
            var uris = Serialization.TryDeserialize <string[]>(request, response);

            if (uris.IsFailure)
            {
                return(Task.CompletedTask);
            }

            return(Converter.PassThrough <GetDomainObject, GetDomainObject.Argument>(
                       context,
                       new GetDomainObject.Argument
            {
                Name = domainObject,
                Uri = uris.Result,
                MatchOrder = order == "match"
            }));
        }
        public Stream GetHistoryFrom(string root, Stream body)
        {
            var type = Utility.CheckAggregateRoot(DomainModel, root);
            var uris = Serialization.TryDeserialize <string[]>(body);

            if (type.IsFailure || uris.IsFailure)
            {
                return(type.Error ?? uris.Error);
            }
            return
                (Converter.PassThrough <GetRootHistory, GetRootHistory.Argument>(
                     new GetRootHistory.Argument
            {
                Name = root,
                Uri = uris.Result
            }));
        }
        public Stream FindFrom(string domainObject, string order, Stream body)
        {
            var type = Utility.CheckIdentifiable(DomainModel, domainObject);
            var uris = Serialization.TryDeserialize <string[]>(body);

            if (type.IsFailure || uris.IsFailure)
            {
                return(type.Error ?? uris.Error);
            }
            return
                (Converter.PassThrough <GetDomainObject, GetDomainObject.Argument>(
                     new GetDomainObject.Argument
            {
                Name = domainObject,
                Uri = uris.Result,
                MatchOrder = order == "match"
            }));
        }
        public Task GetHistory(string root, HttpContext context)
        {
            var request  = context.Request;
            var response = context.Response;
            var type     = Utility.CheckAggregateRoot(DomainModel, root, response);

            if (type.IsFailure)
            {
                return(Task.CompletedTask);
            }
            var uris = Serialization.TryDeserialize <string[]>(request, response);

            if (uris.IsFailure)
            {
                return(Task.CompletedTask);
            }
            return(Converter.PassThrough <GetRootHistory, GetRootHistory.Argument>(
                       context,
                       new GetRootHistory.Argument
            {
                Name = root,
                Uri = uris.Result
            }));
        }