2 Commits

Author SHA1 Message Date
Elivo 41cf6ccd7c Apewer-6.8.8 6 months ago
Elivo 294176d262 修正派生类属性重写未生效的问题。 6 months ago
  1. 2
      Apewer/Apewer.props
  2. 38
      Apewer/Source/TableStructure.cs
  3. 14
      ChangeLog.md

2
Apewer/Apewer.props

@ -7,7 +7,7 @@
<Description></Description> <Description></Description>
<RootNamespace>Apewer</RootNamespace> <RootNamespace>Apewer</RootNamespace>
<Product>Apewer Libraries</Product> <Product>Apewer Libraries</Product>
<Version>6.8.7</Version>
<Version>6.8.8</Version>
</PropertyGroup> </PropertyGroup>
<!-- 生成 --> <!-- 生成 -->

38
Apewer/Source/TableStructure.cs

@ -225,26 +225,34 @@ namespace Apewer.Source
{ {
if (type == null) throw new ArgumentNullException(nameof(type)); if (type == null) throw new ArgumentNullException(nameof(type));
// 需要获取属性的类型。
var types = new List<Type>();
{
var target = type;
// 获取所有属性的名称,基类在前。
var chian = new List<Type>();
var current = type;
while (true) while (true)
{ {
if (target.Equals(RuntimeUtility.ObjectType)) break;
types.Add(target);
target = target.BaseType;
}
if (current.Equals(RuntimeUtility.ObjectType)) break;
chian.Add(current);
current = current.BaseType;
} }
// 所有属性。
var list = new List<PropertyInfo>();
for (var i = types.Count - 1; i >= 0; i--)
var names = new List<string>();
for (var i = chian.Count - 1; i >= 0; i--)
{
var declared = chian[i].GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
foreach (var property in declared)
{
if (names.Contains(property.Name))
{ {
var properties = types[i].GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
list.Add(properties);
continue;
} }
return list.ToArray();
names.Add(property.Name);
}
}
// 获取所有属性。
var properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
var result = names.Map(n => properties.Find(p => p.Name == n));
result = result.FindAll(p => p != null);
return result;
} }
#endregion #endregion

14
ChangeLog.md

@ -1,7 +1,13 @@
### 6.8.7
- 增加 TextUtility.Distinct 方法,对字符串集合去重;
- 增加 ApiInvoker.AddMiddleware 方法,以支持中间件;
- 增加 SqlClient.QueryExecutingStatement 方法,用于查询正在执行的语句。
### 6.8.8
- 问题修正
- 修正 TableStructure 中派生类属性未生效的问题;
- 修改 IndexAttribute 中排序参数的类型名称,解决常用名称与应用冲突的问题。
### 6.8.7
- 问题修正
- 增加 TextUtility.Distinct 方法,对字符串集合去重;
- 增加 ApiInvoker.AddMiddleware 方法,以支持中间件;
- 增加 SqlClient.QueryExecutingStatement 方法,用于查询正在执行的语句。
### 6.8.6 ### 6.8.6
- 新特性 - 新特性

Loading…
Cancel
Save