You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
715 B
32 lines
715 B
using System.Reflection;
|
|
using WTA.Shared.Attributes;
|
|
|
|
namespace WTA.Shared.Mappers;
|
|
|
|
public class FromInjection : ToInjection
|
|
{
|
|
private readonly string[] properties;
|
|
|
|
public FromInjection()
|
|
{
|
|
this.properties = Array.Empty<string>();
|
|
}
|
|
|
|
public FromInjection(string[] properties)
|
|
{
|
|
this.properties = properties;
|
|
}
|
|
|
|
protected override void SetValue(object source, object target, PropertyInfo sp, PropertyInfo tp)
|
|
{
|
|
if (this.properties.Contains(tp.Name))
|
|
{
|
|
return;
|
|
}
|
|
if (tp.GetCustomAttribute<IgnoreUpdateAttribute>() != null)
|
|
{
|
|
return;
|
|
}
|
|
base.SetValue(source, target, sp, tp);
|
|
}
|
|
}
|
|
|