Esempio n. 1
0
 public GetHeroResultBuilder(
     IEntityStore entityStore,
     Func <JsonElement, EntityId> extractId,
     IOperationResultDataFactory <GetHeroResult> resultDataFactory,
     ISerializerResolver stringParser)
 {
     _entityStore       = entityStore;
     _extractId         = extractId;
     _resultDataFactory = resultDataFactory;
     _stringParser      = stringParser.GetLeafValueParser <string, string>("String");
 }
Esempio n. 2
0
        public OperationResult(
            T?data,
            IOperationResultDataInfo?dataInfo,
            IOperationResultDataFactory <T> dataFactory,
            IReadOnlyList <IClientError>?errors,
            IReadOnlyDictionary <string, object?>?extensions  = null,
            IReadOnlyDictionary <string, object?>?contextData = null)
        {
            if (data is null && errors is null)
            {
                throw new ArgumentNullException(nameof(data), Response_BodyAndExceptionAreNull);
            }

            Data        = data;
            DataInfo    = dataInfo;
            DataFactory = dataFactory;
            Errors      = errors ?? Array.Empty <IClientError>();
            Extensions  = extensions ?? ImmutableDictionary <string, object?> .Empty;
            ContextData = contextData ?? ImmutableDictionary <string, object?> .Empty;
        }