12345678910111213141516171819202122232425262728 |
- using System;
- using System.ComponentModel;
- using System.Linq;
- using System.Reflection;
- namespace FormulaEnginePoC.FormulaEngine.Mapping
- {
- public class PropertyMapping
- {
- [DisplayName("名称")]
- public string Display { get; }
- [DisplayName("字段")]
- public string Name { get; }
- [DisplayName("数据类型")]
- public Type DataType { get; }
- public PropertyMapping(PropertyInfo prop)
- {
- Name = prop.Name;
- Display = prop.GetCustomAttributes(typeof(DisplayNameAttribute), true)
- .OfType<DisplayNameAttribute>()
- .FirstOrDefault()?.DisplayName ?? Name;
- DataType = prop.PropertyType;
- }
- }
- }
|