【发布时间】:2013-03-27 23:38:30
【问题描述】:
我目前正在尝试使用 C# 和 System.Data.SQLite 将大量数据添加到我的 Windows 8 应用程序中的 SQLite 数据库中。我有一个列表中的所有对象(MediaItem),我正在使用 foreach 循环将每个对象添加到数据库中。不幸的是,这很慢,所以我想知道是否有办法加快速度。例如,我可以将完整列表交给数据库吗? 到目前为止,这是我的代码:
List<MediaItem> items;
// adding lots of onbjects to the list...
using (var db = new SQLiteConnection(dbPath))
{
foreach (var item in items)
{
db.Insert(item);
}
}
【问题讨论】:
标签: c# database sqlite windows-store-apps