本文整理汇总了C#中SQLite.SQLiteAsyncConnection.InsertAllAsync方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.InsertAllAsync方法的具体用法?C# SQLiteAsyncConnection.InsertAllAsync怎么用?C# SQLiteAsyncConnection.InsertAllAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteAsyncConnection
的用法示例。
在下文中一共展示了SQLiteAsyncConnection.InsertAllAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRecipesAsync
private async Task AddRecipesAsync()
{
var list = await GetAllRecepiesFromHttpRequest();
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(dbName);
await conn.InsertAllAsync(list);
}
示例2: RecreateDb
async void RecreateDb (SQLiteAsyncConnection connection, bool init)
{
await connection.CreateTablesAsync<Ticket, User> ();
if (init) {
await connection.InsertAllAsync (new [] {
new User{ Name = "Dmitry Reshetnik", CreationDateTime = DateTime.UtcNow },
new User{ Name = "Oleg Tyshchenko", CreationDateTime = DateTime.UtcNow },
});
}
}
示例3: PrepareDatabase
private async Task PrepareDatabase()
{
var path = Path.Combine(Path.GetDirectoryName(typeof(TodoService).Assembly.Location), "todos.db");
if (File.Exists(path))
File.Delete(path);
var db = new SQLiteAsyncConnection(path);
await db.CreateTableAsync<TodoItem>();
var count = await db.InsertAllAsync(Todos);
Assert.Equal(Todos.Count, count);
}
示例4: LottoLiveResultsAsync
private async Task LottoLiveResultsAsync()
{
var result = new List<LottoLiveResults>()
{
new LottoLiveResults()
{
date = "2015-08-20",
num1 = 10,
num2 = 30,
num3 = 20,
num4 = 40,
num5 = 44,
num6 = 5,
bonus = 3
},
};
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("LottoAppProject.db");
await conn.InsertAllAsync(result);
}
示例5: AddUsersAsync
private async Task AddUsersAsync()
{
var userList = new List<User>()
{
new User()
{
Surname = "Bisho",
name = "Samuel"
},
};
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("LottoAppProject.db");
await conn.InsertAllAsync(userList);
}
示例6: CreateDatabase
private static Task CreateDatabase (SQLiteAsyncConnection connection, CancellationToken cancellationToken)
{
return Task.Factory.StartNew(() =>
{
//Create the tables
var createTask = connection.CreateTablesAsync (tableTypes);
createTask.Wait();
//Count number of assignments
var countTask = connection.Table<Assignment>().CountAsync();
countTask.Wait();
//If no assignments exist, insert our initial data
if (countTask.Result == 0)
{
var insertTask = connection.InsertAllAsync(TestData.All);
//Wait for inserts
insertTask.Wait();
//Mark database created
initialized = true;
}
});
}
示例7: AddUniversitiesAsync
//.........这里部分代码省略.........
Name = "University of South Africa",
},
new Universities()
{
Name = "University of Kwazulu Natal",
},
new Universities()
{
Name = "University of Stellenbosch",
},
new Universities()
{
Name = "University of Mpumalanga",
},
new Universities()
{
Name = "University of Venda",
},
new Universities()
{
Name = "Nelson Mandela Metropolitan Univesity",
},
/////////////////////////////////////////////////////////New
new Universities()
{
Name = "North West University",
},
new Universities()
{
Name = "University of the Witwatersrand",
},
new Universities()
{
Name = "University of Cape Town",
},
new Universities()
{
Name = "Durban University of Technology",
},
new Universities()
{
Name = "University of the Western Cape",
},
new Universities()
{
Name = "Walter Sisulu University",
},
new Universities()
{
Name = "Cape Peninsula University of Technology",
},
new Universities()
{
Name = "Vaal University of Technology",
},
new Universities()
{
Name = "Sol Plaatje University",
},
};
// Add rows to the User Table
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("institutionFinder.db");
await conn.InsertAllAsync(universitiesLists);
}
示例8: AddCoursesAsync
//.........这里部分代码省略.........
},
new Courses()
{
Id = 20,
courses = "Global Journalism ",
},
new Courses()
{
Id = 21,
courses = "Financial Economics ",
},
new Courses()
{
Id = 28,
courses = "Educational Studies ",
},
new Courses()
{
Id = 28,
courses = "Education ",
},
new Courses()
{
Id = 26,
courses = "Creative Writing",
},
new Courses()
{
Id = 21,
courses = "Computer Science, Advanced (Enterprise Computing)",
},
new Courses()
{
Id = 24,
courses = "Business Administration",
},
new Courses()
{
Id = 30,
courses = "Quantity Survey Engineering",
},
new Courses()
{
Id = 19,
courses = "Applied Linguistics with TESOL - MA/Diploma",
},
new Courses()
{
Id = 26,
courses = "Advanced Software Engineering - MSc(Eng)",
},
new Courses()
{
Id = 25,
courses = "Utility Lineworker Technology",
},
new Courses()
{
Id = 17,
courses = "Health Care Assistant",
},
new Courses()
{
Id = 16,
courses = "Commercial Truck Driving",
},
new Courses()
{
Id = 24,
courses = "Business & Marketing Management",
},
new Courses()
{
Id = 23,
courses = "Automation & Control",
}
};
// Add rows to the User Table
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("institutionFinder.db");
await conn.InsertAllAsync(userList);
}
示例9: LottoSavedAsync
private async Task LottoSavedAsync()
{
var saved = new List<LottoSaved>()
{
new LottoSaved()
{
num1 = 2,
num2 = 1,
num3 = 34,
num4 = 3,
num5 = 23,
num6 = 9
},
};
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("LottoAppProject.db");
await conn.InsertAllAsync(saved);
}
示例10: CreateTaiKhoanItems
private async Task CreateTaiKhoanItems()
{
var taikhoanlist = new List<taikhoan>
{
new taikhoan()
{
Tentaikhoan = "Tiền mặt",
Sotienbandau = "-10000000",
Loaitiente = "USD",
Loaitaikhoan = "Ví",
Ghichu = "Không có"
}
};
var ghichepList = new List<ghichep>
{
new ghichep()
{
Ghichu = "Khong co",
Mucdichchi="khong biet",
Loai = "Thu tien",
Sotien = "1202"
}
};
// Add rows to the taisan Table
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("moneybook.db");
await conn.InsertAllAsync(taikhoanlist);
await conn.InsertAllAsync(ghichepList);
}
示例11: AddUsersAsync
private async Task AddUsersAsync()
{
// Create a users list
var duaList = new List<Dualar>()
{
new Dualar()
{
DuaName = "Allahu Ekber",
Dua = "Allahu Ekber",
kacKezOkunmali=100,
kacKezOkundu=0
},
new Dualar()
{
DuaName = "La ilahe İllallah",
Dua = "La ilahe İllallah",
kacKezOkunmali=100,
kacKezOkundu=0
},
new Dualar()
{
DuaName = "Subhanallah",
Dua = "Subhanallah",
kacKezOkunmali=100,
kacKezOkundu=0
},
new Dualar()
{
DuaName = "Elhamdulillah",
Dua = "Elhamdulillah",
kacKezOkunmali=100,
kacKezOkundu=0
},
new Dualar()
{
DuaName = "Tövbe Estağfurullah",
Dua = "Tövbe Estağfurullah",
kacKezOkunmali=100,
kacKezOkundu=0
},
new Dualar()
{
DuaName = "Kelime-i Tevhid",
Dua = "La ilahe İllallah, Muhammedün Resulullah",
kacKezOkunmali=100,
kacKezOkundu=0
},
new Dualar()
{
DuaName="Kelime-i Şehadet",
Dua ="Eşhedü en la ilahe illallah ve eşhedü enne Muhammeden abdühü ve resulühü",
kacKezOkunmali=100,
kacKezOkundu=0
},
new Dualar()
{
DuaName ="Salavat-ı Şerif",
Dua = "Allahümme Salli Ala Seyyidina Muhammedin ve Ala Ali Seyyidina Muhammed",
kacKezOkunmali=100,
kacKezOkundu=0
}
};
var sayacList = new List<Zikirmatik>()
{
new Zikirmatik()
{
Counter=0
}
};
// Add rows to the User Table
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("duaDB.db");
await conn.InsertAllAsync(duaList);
await conn.InsertAllAsync(sayacList);
//Zikirmatiğin sayacı son kaldığı değere setleniyor
var allusers = await conn.QueryAsync<Zikirmatik>("SELECT Counter FROM ZikirmatikSayac WHERE Id = 1");
foreach (var user in allusers)
{
Sayac.Text = user.Counter.ToString();
}
}
示例12: UpdateDataAsync
public static async Task<bool> UpdateDataAsync()
{
bool updated = false;
WebHelper webHelper = new WebHelper();
if (await webHelper.getAllData())
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\Data.db");
await conn.DropTableAsync<Term>();
await conn.DropTableAsync<Lesson>();
await conn.DropTableAsync<Exam>();//删除之前的数据
await conn.DropTableAsync<Course>();//不提示成绩更新情况下,直接删除成绩
await conn.CreateTablesAsync<Course, Term, Lesson, Exam>();
await conn.InsertAllAsync(webHelper.Exams);//update exams;
await conn.InsertAllAsync(webHelper.Terms);
await conn.InsertAllAsync(webHelper.Lessons);
await conn.InsertAllAsync(webHelper.Courses);
Term.ClearData();
Exam.ClearData();
WeekDay.ClearData();
updated = true;
}
return updated;
////区分有无成绩更新,方便后续扩展出成绩提示
//var previousCourses = terms.SelectMany(term => term.Courses);
//var updateCourses = from course in webHelper.Courses
// let previousCourse = from tempCourse in previousCourses
// where tempCourse.CourseName == course.CourseName &&
// tempCourse.TermNumber == course.TermNumber &&
// (tempCourse.GradePoints != course.GradePoints | tempCourse.MakeUpExamGrades != course.MakeUpExamGrades)
// select tempCourse
// where previousCourse.Any()
// select course;
//var newCourses = from course in webHelper.Courses
// let previousCourse = from tempCourse in previousCourses
// where tempCourse.CourseName == course.CourseName &&
// tempCourse.TermNumber == course.TermNumber
// select tempCourse
// where !previousCourse.Any()
// select course;
//var updatedCourse = updateCourses.ToList();
// var newcourses = newCourses.ToList();
//if (updateCourses.Any() | newCourses.Any())
//{
// try
// {
// await conn.InsertAllAsync(newCourses);
// await conn.UpdateAllAsync(updateCourses);
// }
// catch (Exception)
// {
// await conn.DropTableAsync<Course>();
// var message = new Windows.UI.Popups.MessageDialog("更新本地数据出错,建议或重试,或进入设置删除本地账号和数据或重启应用后再导入");
// await message.ShowAsync();
// }
// updated = true;
//}
}
示例13: InsertList
/// <summary>
/// Supposed to add 3 records to table
/// Upon query only get first returned
/// BUT id is incremented for 3 records added ???
/// </summary>
public async void InsertList()
{
SQLiteAsyncConnection connection = new SQLiteAsyncConnection(textBox.Text);
var SensorList = new List<Sensor>()
{
new Sensor()
{
dateTime = DateTime.Now,
Name="Temperature1",
Value = GetRandomValue("Temperature1")
},
new Sensor()
{
dateTime = DateTime.Now,
Name="Temperature2",
Value = GetRandomValue("Temperature2")
},
new Sensor()
{
dateTime = DateTime.Now,
Name="Humidity1",
Value = GetRandomValue("Humidity1")
}
};
int n = await connection.InsertAllAsync(SensorList);
}
示例14: AddArticlesAsync
private async Task AddArticlesAsync()
{
// Create a Articles list
var list = new List<Article>()
{
new Article()
{
Title = "Hackers exploit touch payment tech",
Content = "Security experts testing ways to break smartphone software have found several bugs in the NFC payment system found on many handsets."
},
new Article()
{
Title = "Assassin's Creed glitches criticised",
Content = "Widespread glitches in French Revolution-set Assassin's Creed: Unity have put its publisher Ubisoft under pressure."
}
};
// Add rows to the Article Table
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(dbName);
await conn.InsertAllAsync(list);
}
示例15: LottoPlusResultsAsync
private async Task LottoPlusResultsAsync()
{
var res = new List<LottoPlusResults>()
{
new LottoPlusResults()
{
date = "2015-08-20",
num1 = 0,
num2 = 0,
num3 = 0,
num4 = 0,
num5 = 0,
num6 = 0,
bonus = 0
},
};
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("LottoAppProject.db");
await conn.InsertAllAsync(res);
}