Saturday, August 12, 2017

Traveller Tracker - adding ship logs

I've added the cargo table definition and the log definition.  Had to also add them to the TravellerContext to get added to the database. That took a bit of digging since it has been a few months since I looked at this sadly.

Anyway, I added an initial dialog box to get a new log entry in. It needs work, and I do believe I am going to abstract that a bit more to have a single class to handle the dialogs to centralize things a bit and minimize repeating code.  I know, a class for a class, so I need to think a bit more on it.

Getting my head wrapped back around C# after more than a year of Filemaker is interesting...

TravellerContext:
using Microsoft.EntityFrameworkCore;
using Traveller.Models;

namespace TravellerTracker.Models
{
    public class TravellerContext : DbContext
    {
        public DbSet Ships { get; set; }
        public DbSet ShipClasses { get; set; }
        public DbSet Cargoes { get; set; }
        public DbSet Logs { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            try
            {
                optionsBuilder.UseSqlite("Data Source=TravellerTracker.db");
            }
            catch (System.Exception ex)
            {
                var a = ex;
                throw;
            }
        }
    }
}





1 comment:

Shawn Driscoll said...

I'll quickly forget a computer language if I don't look at it for a year.