FluentData/Command/PartialClasses/Query.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
namespace FluentData
{
internal partial class DbCommand
{
private TList Query<TEntity, TList>(
Action<IDataReader, TEntity> customMapperReader,
Action<dynamic, TEntity> customMapperDynamic)
where TList : IList<TEntity>
{
var items = default(TList);
_data.ExecuteQueryHandler.ExecuteQuery(true, () =>
{
items = new GenericQueryHandler<TEntity>().ExecuteListReader<TList>(_data, customMapperReader, customMapperDynamic);
});
return items;
}
public TList Query<TEntity, TList>()
where TList : IList<TEntity>
{
return Query<TEntity, TList>(null, null);
}
public List<TEntity> Query<TEntity>()
{
return Query<TEntity, List<TEntity>>(null, null);
}
public TList Query<TEntity, TList>(Action<IDataReader, TEntity> customMapper)
where TList : IList<TEntity>
{
return Query<TEntity, TList>(customMapper, null);
}
public TList Query<TEntity, TList>(Action<dynamic, TEntity> customMapper)
where TList : IList<TEntity>
{
return Query<TEntity, TList>(null, customMapper);
}
public List<TEntity> Query<TEntity>(Action<IDataReader, TEntity> customMapper)
{
return Query<TEntity, List<TEntity>>(customMapper, null);
}
public List<TEntity> Query<TEntity>(Action<dynamic, TEntity> customMapper)
{
return Query<TEntity, List<TEntity>>(null, customMapper);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
