Quantcast
Channel: Xamarin.Mac — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 1429

How to Implement a Data Model

$
0
0

Hello,
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; }
        #endregion

        #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;
        }
        #endregion
    }
}

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.


Viewing all articles
Browse latest Browse all 1429

Latest Images

Trending Articles



Latest Images