Return value for create database or not

WillHampton.1776WillHampton.1776 USMember ✭✭

Need to have a way to know if the code below created a database or not. The reason is if the database was created, the app starts on a different page than if it wasn't. The CreateTable method has no return value, even though the behavior is "Create if not exists already"

public DataAccess() { database = DependencyService.Get<IDatabaseConnection>().DbConnection(); //Creates table if not exists database.CreateTable<Person>(); //If table is empty, intialize }

Tagged:

Posts

  • JimBennettJimBennett GBXamarin Team, Insider, University, Developer Group Leader ✭✭✭✭

    Can you check for entries in the database, rather than if it exists, to determine what page to start from.

    For example in an app I'm writing I create the tables every time, then check for an entry in a logged on user table to determine if the app should show a login page or not.

Sign In or Register to comment.