/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Initializers/PropertyProviders/InputPropertyProvider.cs
36 строк
1 KB
Chris Patterson
Integration of all external packages into MassTransit, split out into Abstractions, Middleware, and the core MassTransit assembly.
22 янв 2022, 18:24
22 янв 2022, 18:24
b5b4f50
Код
Авторство
О чём код?
namespace MassTransit.Initializers.PropertyProviders { using System; using System.Reflection; using System.Threading.Tasks; using Internals; /// <summary> /// Copies the input property, as-is, for the property value /// </summary> /// <typeparam name="TInput"></typeparam> /// <typeparam name="TProperty"></typeparam> public class InputPropertyProvider<TInput, TProperty> : IPropertyProvider<TInput, TProperty> where TInput : class { readonly IReadProperty<TInput, TProperty> _inputProperty; public InputPropertyProvider(PropertyInfo propertyInfo) { if (propertyInfo == null) throw new ArgumentNullException(nameof(propertyInfo)); _inputProperty = ReadPropertyCache<TInput>.GetProperty<TProperty>(propertyInfo); } public Task<TProperty> GetProperty<T>(InitializeContext<T, TInput> context) where T : class { return Task.FromResult(context.HasInput ? _inputProperty.Get(context.Input) : default); } } }