------ #### MyDbV4 V3.0.2107.2901 - *.[新增]新增支持计算文件MD5。 - *.[新增]部分DataProvider功能移植到DbExtension里,增加扩展性。 - *.[新增]UnixTimeToDateTime和JSTimeToDateTime新增支持long参数。 - *.[合并]合并RyWeb项目到MyDb里。 #### ryControlsV4 V3.0.2107.2901 - *.[改进]优化减少大量IDE警告和消息。
58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Reflection;
|
|
using System.Diagnostics;
|
|
|
|
namespace Sheng.Winform.Controls.Kernal
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class ConstructorInvokerPool : FastReflectionPool<Type[], IConstructorInvoker>
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public ConstructorInvokerPool()
|
|
{
|
|
CustomCompare = true;
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="key1"></param>
|
|
/// <param name="key2"></param>
|
|
/// <returns></returns>
|
|
protected override bool Compare(Type[] key1, Type[] key2)
|
|
{
|
|
return key1.SequenceEqual(key2);
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="type"></param>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
protected override IConstructorInvoker Create(Type type, Type[] key)
|
|
{
|
|
if (type == null || key == null)
|
|
{
|
|
Debug.Assert(false, "type 或 key 为空");
|
|
throw new ArgumentNullException();
|
|
}
|
|
|
|
ConstructorInfo constructorInfo = type.GetConstructor(key);
|
|
|
|
if (constructorInfo == null)
|
|
{
|
|
Debug.Assert(false, "没有指定的ConstructorInfo");
|
|
throw new InvalidOperationException();
|
|
}
|
|
|
|
return new ConstructorInvoker(constructorInfo);
|
|
}
|
|
}
|
|
}
|