本文整理汇总了C#中SQLiteAsyncConnection.Table方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.Table方法的具体用法?C# SQLiteAsyncConnection.Table怎么用?C# SQLiteAsyncConnection.Table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLiteAsyncConnection
的用法示例。
在下文中一共展示了SQLiteAsyncConnection.Table方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryForStop
public async static Task<List<Stop>> QueryForStop(string selectedStop)
{
//string query = "SELECT * FROM BusStops WHERE StopName IS \"" + selectedStop + "\"";
//var _stopsAsyncConnection = new SQLiteAsyncConnection("muni.sqlite");
var connection = new SQLiteAsyncConnection(() => DbConnection(muniDbPath));
var results = await connection.Table<Stop>().Where(s => s.StopName == selectedStop).ToListAsync();
//var results = await connection.QueryAsync<Stop>(query);
if (!results.Any())
{
string[] temp = selectedStop.Split('&');
if (temp.Count() > 1)
{
selectedStop = temp[1].Substring(1) + " & " + temp[0].Substring(0, (temp[0].Length - 1));
}
results = await connection.Table<Stop>().Where(s => s.StopName == selectedStop).ToListAsync();
}
connection = null;
return results;
}
示例2: SomeOtherTest
public static async void SomeOtherTest()
{
var id = new Guid("d834d9bc-12f9-47a2-80c1-58c65eddfa14");
var c1 = new SQLiteAsyncConnection(Client1DB.SampleDatabasePath(), true);
var c2 = new SQLiteAsyncConnection(Client1DB.SampleDatabasePath(), true);
var a = await c1.Table<AggregateEvent>().Where(x => x.Identity == id).FirstAsync();
var b = await c1.Table<AggregateEvent>().Where(x => x.Identity == id).FirstAsync();
// a.Version = 1;
// var t1 = c1.UpdateAsync(a);
// a.Version = 2;
// var t2 = c1.UpdateAsync(a);
var t1 = c1.Table<AggregateEvent>().ToListAsync();
var t2 = c1.Table<AggregateEvent>().ToListAsync();
await Task.WhenAll(t1, t2);
Console.WriteLine("{0} on thread {1}", t1.Result.Count + t2.Result.Count, Thread.CurrentThread.ManagedThreadId);
}
示例3: GetAsync
/// <summary>
/// Gets the database version entry.
/// </summary>
/// <param name="asyncDbConnection">The asynchronous database connection.</param>
public static async Task<DatabaseVersion> GetAsync(SQLiteAsyncConnection asyncDbConnection)
{
return await asyncDbConnection.Table<DatabaseVersion>().FirstOrDefaultAsync().ConfigureAwait(false);
}
示例4: QueryForRoutesAsync
public static async Task<List<Route>> QueryForRoutesAsync()
{
//var list = new List<string>();
var results = new List<Route>();
//var _stopsAsyncConnection = new SQLiteAsyncConnection("muni.sqlite");
var _stopsAsyncConnection = new SQLiteAsyncConnection(() => DbConnection(muniDbPath));
results = await _stopsAsyncConnection.Table<Route>().ToListAsync();
_stopsAsyncConnection = null;
//foreach (var route in query)
//{
// list.Add(route.Title);
//}
return results;
}
示例5: FavoriteSearchAsync
public static async Task FavoriteSearchAsync(Stop stop)
{
string title = stop.StopName;
if (title.Contains("Inbound"))
{
title = title.Replace(" Inbound", "");
}
if (title.Contains("Outbound"))
{
title = title.Replace(" Outbound", "");
}
//var _stopsAsyncConnection = new SQLiteAsyncConnection("muni.sqlite");
var connection = new SQLiteAsyncConnection(() => DbConnection(muniDbPath));
//string query = "SELECT * FROM BusStops WHERE StopName = \'" + title + "\'";
var results = await connection.Table<Stop>().Where(s => s.StopName == title).ToListAsync();
//If stop name not found in db, most likely a stop that was a duplicate and merged so reverse it and search again
if(!results.Any())
{
string [] temp = title.Split('&');
title = temp[1].Substring(1) + " & " + temp[0].Substring(0, (temp[0].Length - 1));
//query = "SELECT * FROM BusStops WHERE StopName = \'" + title + "\'";
results = await connection.Table<Stop>().Where(s => s.StopName == title).ToListAsync();
}
foreach (Stop fav in results)
{
await AddFavoriteAsync(stop);
}
}
示例6: GetAllDZdraviloAsync
//public static List<Zdravilo> GetAllDZdravilo()
//{
// using (var db = DbConnection)
// {
// return db.Table<Zdravilo>().ToList();
// }
//}
public static async Task<List<Zdravilo>> GetAllDZdraviloAsync()
{
var conn = new SQLiteAsyncConnection(
() =>
new SQLiteConnectionWithLock(new SQLitePlatformWinRT(),
new SQLiteConnectionString(DbPath, storeDateTimeAsTicks: false)));
List<Zdravilo> seznamZdravil = await conn.Table<Zdravilo>().ToListAsync();
return seznamZdravil;
}