33 lines
876 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Text;
namespace JiShe.CollectBus.Analyzers.Shared
{
/// <summary>
/// 实体成员信息
/// </summary>
public sealed class EntityMemberInfo
{
public string Path { get; set; }
public Type Type { get; set; }
private readonly Func<object, object> _getter;
private readonly Action<object, object> _setter;
public EntityMemberInfo(
string path,
Type type,
Func<object, object> getter,
Action<object, object> setter)
{
Path = path;
Type = type;
_getter = getter;
_setter = setter;
}
public object GetValue(object entity) => _getter(entity);
public void SetValue(object entity, object value) => _setter(entity, value);
}
}