Reader small image

You're reading from  Cross-platform UI Development with Xamarin.Forms

Product typeBook
Published inAug 2015
Reading LevelBeginner
Publisher
ISBN-139781784391195
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Paul Johnson
Paul Johnson
author image
Paul Johnson

Paul Johnson has been writing software since the early 1980s on machines ranging from the ZX81 and servers to his trusty Mac, and has used more languages than he can remember. He is a qualified scuba diver and college lecturer. Paul lives with his wife, kids, and pets, and listens to an inordinate amount of rock and metal on Primordial Radio. This is his third book for Packt.
Read more about Paul Johnson

Right arrow

The database helper class


All smart phones come with a version of SQLite installed (including the likes of the Blackberry range), and while SQLite provides a number of inbuilt methods of storing data, they are often cumbersome and in terms of what they do (or how they do it), aren't exactly clear.

The second problem is that the connection has to be made every time a query is to be made.

Thankfully, it is more than possible to write a helper class that deals with the creation, insertion, amendment, and retrieval of data.

There are a number of advantages to having a helper class in this situation:

  • All the data methods are in one place (reducing the number of times code has to be written; therefore, less opportunity for error)

  • Potential for commonality of code to be reduced, making the database footprint smaller

  • Data retrieval can be made simpler

  • Lends well to generic types and optimization of the retrieval of data

Generic types within the helper class

While it is always useful to have, say, a method...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Cross-platform UI Development with Xamarin.Forms
Published in: Aug 2015Publisher: ISBN-13: 9781784391195

Author (1)

author image
Paul Johnson

Paul Johnson has been writing software since the early 1980s on machines ranging from the ZX81 and servers to his trusty Mac, and has used more languages than he can remember. He is a qualified scuba diver and college lecturer. Paul lives with his wife, kids, and pets, and listens to an inordinate amount of rock and metal on Primordial Radio. This is his third book for Packt.
Read more about Paul Johnson