Professional Documents
Culture Documents
Worksheet 4.8 SQ LITE .
Worksheet 4.8 SQ LITE .
VOCABULARY
1. A relational database is a type of database that stores and provides access to
data points that are related to one another.
2. C++ (/ˌsiːˌplʌsˈplʌs/) is a general-purpose programming language created
by Bjarne Stroustrup as an extension of the C programming language, or "C
with Classes".
3. API is the acronym for Application Programming Interface, which is a
software intermediary that allows two applications to talk to each other.
Each time you use an app like Facebook, send an instant message, or check
the weather on your phone, you’re using an API.
4. Xamarin is a free, Cross-platform, open source. It is an app platform for
building Android and iOS apps with .NET and C#.
5. In a software context, the term “wrapper” refers to programs or codes that
literally wrap around other program components. Several different wrapper functions can
be distinguished. They are often used for ensuring compatibility or interoperability
between different software structures.
6. Object–relational mapping (ORM, O/RM, and O/R mapping tool) in computer science is
a programming technique for converting data between incompatible type systems
using object-oriented programming languages. This creates, in effect, a
"virtual object database" that can be used from within the programming language.
7. Snippet is a programming term for a small region of re-usable source code, machine
code, or text.
SQLite
Storing data in SQLite is useful when you have relational data. For example, suppose you
are building an application to manage a library. Each book in the library has one or more
authors, and an author can write multiple books. This kind of relationship can be easily
modeled in a SQLite database.
In this unit, you'll learn how to use SQLite in a Xamarin application by using SQLite.NET.
Section 3: Why many Xamarin developers use a popular C # container called SQLite.NET?
There are several C# wrappers around the native SQLite engine that .NET developers can
use. Many Xamarin developers use a popular C# wrapper called SQLite.NET.
By using an object-relational mapper, you can take this initial User class and automatically
have it create a database table called User that has columns for Id and Username.
Remember that SQLite.NET is an object-relational mapper, which means you can build our
database schema from C# classes. Let's go back to the previous example of our User class.
SQLite.NET can build our database schema from this C# class, but there are many attributes that
you can add to the class to make modifications to the schema.
● Table: Specify the name of the table if you want it to be something other than the class's
name.
● PrimaryKey: Specify that a column is the primary key.
● AutoIncrement: Specify that a column should automatically increase in value when a new
row is inserted.
● Column: Specify the name of a column if you want it to be something other than the
property name.
● MaxLength: Specify the maximum number of characters that can be used in the column.
● Unique: Specify that the value in the column must be unique from all other rows.
Going back to the User class, following is an updated version that uses all these attributes:
After you define our C# class to use as our database schema, you need to tell SQLite.NET to create
the table. To do that, use the CreateTable method on the SQLiteConnection class. Here's an
example:
If you call the CreateTable method and the table already exists in the database, it checks the
schema class to see if there are any changes. If there are any changes, the operation becomes an
update, and it attempts to update the database schema.
Self-evaluation
Complete the following self-evaluation section.