当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteAsyncConnection.Table方法代码示例

本文整理汇总了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;
        }
开发者ID:nexDevelopment,项目名称:nexMUNI,代码行数:23,代码来源:DatabaseHelper.cs

示例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);
        }
开发者ID:sgmunn,项目名称:Mobile.CQRS,代码行数:23,代码来源:SyncSample.cs

示例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);
 }
开发者ID:Luminoth,项目名称:BackpackPlanner,代码行数:8,代码来源:DatabaseVersion.cs

示例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;
        }
开发者ID:nexDevelopment,项目名称:nexMUNI,代码行数:16,代码来源:DatabaseHelper.cs

示例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);
            }
        }
开发者ID:nexDevelopment,项目名称:nexMUNI,代码行数:33,代码来源:DatabaseHelper.cs

示例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;


        }
开发者ID:IIIArbiIII,项目名称:MedicineApp,代码行数:20,代码来源:Baza.cs


注:本文中的SQLiteAsyncConnection.Table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。