public Uri GetLocator(
     [Parent] Data.GetHttpsResource getHttpsResource,
     [Service] AppSettings appSettings
     )
 {
     return(new Uri($"{appSettings.Host}/api/resources/{getHttpsResource.Id}"));
 }
Esempio n. 2
0
 protected GetHttpsResourcePayload(
     Data.GetHttpsResource getHttpsResource,
     IReadOnlyCollection <TGetHttpsResourceError> errors
     )
 {
     GetHttpsResource = getHttpsResource;
     Errors           = errors;
 }
        public Task <Data.GetHttpsResource[]> GetChildren(
            [Parent] Data.GetHttpsResource getHttpsResource,
            GetHttpsResourceChildrenByGetHttpsResourceIdDataLoader byId,
            CancellationToken cancellationToken

            )
        {
            return(byId.LoadAsync(getHttpsResource.Id, cancellationToken) !);
        }
Esempio n. 4
0
 protected GetHttpsResourcePayload(
     Data.GetHttpsResource getHttpsResource,
     TGetHttpsResourceError error
     )
     : this(
         getHttpsResource,
         new[] { error }
         )
 {
 }
        public async Task <Data.GetHttpsResource?> GetParent(
            [Parent] Data.GetHttpsResource getHttpsResource,
            GetHttpsResourceByIdDataLoader byId,
            CancellationToken cancellationToken

            )
        {
            // TODO Why is `?? Guid.Empty` below necessary although `getHttpsResource.ParentId` is not null?
            return(getHttpsResource.ParentId is null
                ? null
                : await byId.LoadAsync(getHttpsResource.ParentId ?? Guid.Empty, cancellationToken) !);
        }
        public async Task <Data.IData?> GetData(
            [Parent] Data.GetHttpsResource getHttpsResource,
            CalorimetricDataByIdDataLoader calorimetricDataById,
            HygrothermalDataByIdDataLoader hygrothermalDataById,
            OpticalDataByIdDataLoader opticalDataById,
            PhotovoltaicDataByIdDataLoader photovoltaicDataById,
            CancellationToken cancellationToken

            )
        {
            if (getHttpsResource.CalorimetricDataId is not null)
            {
                return(await calorimetricDataById.LoadAsync(
                           getHttpsResource.CalorimetricDataId ?? throw new Exception("Impossible!"),
                           cancellationToken
                           ).ConfigureAwait(false));
            }
            if (getHttpsResource.HygrothermalDataId is not null)
            {
                return(await hygrothermalDataById.LoadAsync(
                           getHttpsResource.HygrothermalDataId ?? throw new Exception("Impossible!"),
                           cancellationToken
                           ).ConfigureAwait(false));
            }
            if (getHttpsResource.OpticalDataId is not null)
            {
                return(await opticalDataById.LoadAsync(
                           getHttpsResource.OpticalDataId ?? throw new Exception("Impossible!"),
                           cancellationToken
                           ).ConfigureAwait(false));
            }
            if (getHttpsResource.PhotovoltaicDataId is not null)
            {
                return(await photovoltaicDataById.LoadAsync(
                           getHttpsResource.PhotovoltaicDataId ?? throw new Exception("Impossible!"),
                           cancellationToken
                           ).ConfigureAwait(false));
            }
            return(null);
        }
Esempio n. 7
0
 protected GetHttpsResourcePayload(
     Data.GetHttpsResource getHttpsResource
     )
 {
     GetHttpsResource = getHttpsResource;
 }
Esempio n. 8
0
 public CreateGetHttpsResourcePayload(
     Data.GetHttpsResource getHttpsResource
     )
     : base(getHttpsResource)
 {
 }