How to Implement a Data Model

I'm coming from the world of Xcode where working with SQLite is not necessary since they provide CoreData to make it easier to deal with Entities and Attributes. So in my try to create a data model without using the GUI for doing that I'm lost.

The following picture shows what I want to do:

And this is the code where I'm lost.

using System;
using SQLite;

namespace NameAnimalPlants
    public class DataModel
        #region Computed Propoperties

        // I want this separated 
        public string ANameTextField { get; set; } = "";
        public string BNameTextField { get; set; } = "";
        public string CNameTextField { get; set; } = "";

        // I want this separated
        public string AAnimalTextField { get; set; } = "";
        public string BAnimalTextField { get; set; } = "";
        public string CAnimalTextField { get; set; } = "";

        // I want this separated
        public string APlantTextField { get; set; } = "";
        public string BPlantTextField { get; set; } = "";
        public string CPlantTextField { get; set; } = "";

        public SQLiteConnection Conn { get; set; }

        #region Constructors
        public DataModel()

        // How should I implement this method?
        public DataModel (string firstRow, string secondRow, string thirdRow)
            this.ANameTextField = firstRow;
            this.BNameTextField = secondRow;
            this.CNameTextField = thirdRow;

How to separate each entity in my data model? How should I implement each method properly? Any help or tutorial related to the example will be highly appreciated.


  • TimothyRisiXMTimothyRisiXM USXamarin Team Xamurai

    Hi Fotios,

    This forum is primarily for questions about using Xamarin.Mac itself. You'll probably have more luck for questions on things like Sqlite on StackOverflow. That being said, there are some articles in our documentation about using sqlite, such as Creating a Database (Focused on iOS, but the sqlite code should work the same for mac), or the MacDatabase sample

Sign In or Register to comment.