Adding a column

  • Add a new NumberColumn named Id.
  • In the call to the NumberColumn constructor, we'll set the column's name in the database and it's format. To read more about formats go to formatting
  • The member should be public so that we can access it from any class in our code.
  • The member should be readonly to make sure that no one will replace it's reference by mistake - note that it doesn't make the column itself readonly, only makes sure that we'll not replace the reference stored in the Id field. For more info see:Constructors Static and Readonly
using System;
using System.Collections.Generic;
using System.Text;
using Firefly.Box;
using ENV.Data;

namespace Northwind.Models
{
    public class Students : Entity
    {
        public readonly NumberColumn Id = new NumberColumn("Id", "5");
        public Students()
           : base("Students", Northwind.Shared.DataSources.Northwind1)
        {
        }
    }
} 

Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com