samedi 4 avril 2015

How do you create an SQLite Database with c# in Visual Studio?

I am creating an SQLite Database in Visual Studio with Xamarin in C#.


I should note that this is for android only.


From what I understand, in this class I must create the SQLite Database, and make it so I am able to add, delete, and retrieve data.


I should also note that there is a separate class to call the methods in this class.


I am very new to this and I am not sure how to do this.


I've read tutorials, I've watched hour long videos, and I still am not able to figure out this.


Any help would be greatly appreciated.


This is the class template I am using and must follow:



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.

}
}
}

Aucun commentaire:

Enregistrer un commentaire