3
我正在创建一个SQLite
数据库Visual Studio
与Xamarin
在C#
。如何在Visual Studio中用c#创建SQLite数据库?
我应该注意,这仅适用于android
。
据我所知,在这个类中,我必须创建SQLite
数据库,并使其能够添加,删除和检索数据。
我还应该注意到,有一个单独的类来调用此类中的方法。
我对此很新,我不知道如何做到这一点。
我读过教程,我看过一小时长的视频,但我仍然无法弄清楚这一点。
任何帮助将不胜感激。
这是我使用的,并且必须遵循类模板:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using BB.Mobile.Models;
namespace BB.Mobile
{
/// <summary>
/// A class to provide a single interface for interacting with all SQLite data operations for stored tracking points.
/// </summary>
class DataManager
{
/// <summary>
/// Will compile and return all matching unsynchronized ping data from the SQLite database.
/// </summary>
/// <returns></returns>
public List<PingGroup> GetUnsynchronizedPings()
{
List<PingGroup> unsynchronizedPings = new List<PingGroup>();
// TODO: Retrieve all unsynchronized pings from the SQLite database and return them to the caller.
return unsynchronizedPings;
}
/// <summary>
/// Insert a single ping group into the SQLite ping database.
/// </summary>
/// <param name="pingGroup"></param>
public void AddUnsynchronizedPing(PingGroup pingGroup)
{
// TODO: Add the passed ping group parameter into the SQLite database as new/unsynchronized.
}
/// <summary>
/// Mark all open and unsynchronized pings in the database as synchronized.
/// </summary>
public void SetAllPingsSynchronized()
{
// TODO: Delete all database data or set it as synchronized using a flag.
}
}
}
你读过这个吗? http://erikej.blogspot.dk/2014/10/database-first-with-sqlite-in-universal.html – ErikEJ 2015-04-05 11:46:18