【发布时间】:2020-02-19 00:49:09
【问题描述】:
我在一个表中有一个byte[] 列,其中存储了指纹数据。我希望只查询一次表中的行并将记录集存储在变量中或代码中的某个位置,这样我就不必每次都查询数据库。该查询将返回数千行。
这将为我获取所有记录:
var table = (from a in context.tblFingerprints
select new {a} ).ToList();
我尝试在 AppData 类中声明一个变量:public List<object> TableData;
然后尝试将变量“表”值存储到其中。
Data.TableData = table;
错误仍然存在:
无法将类型
'System.Collections.Generic.List<<anonymous type: FingerprintTEST.tblFingerprint a>>'隐式转换为'System.Collections.Generic.List<object>'
这就是我希望查询从结果返回的行以匹配指纹的方式:
foreach (var row in Data.TableData)
{
Template tem = new Template();
tem.DeSerialize(row.a.fingerTemplate);
if (tem != null)
{
// Compare feature set with particular template.
Verificator.Verify(features, tem, ref res);
if (res.Verified)
{...}
}
}
有什么想法吗?
【问题讨论】:
-
context.tblFingerprints的数据类型是什么? -
数据库是为查询而设计的,你遇到过性能问题吗?
-
@MichaelRandall 好吧,随着我的数据库的增长,检索一个指纹并将其与数千条记录进行比较需要更多时间。
标签: c# entity-framework fingerprint digital-persona-sdk