Biggest issue was a naming convention: using Entity Framework and the SQLite stuff there are some assumptions about naming conventions. Fortunately MS/SQLite borrowed from the Ruby On Rails, and I've no idea where they got their ideas from.
Regardless, the screen comes up, and you can add a ship to the library. Right now it has a hard-coded name while I was verifying things worked; next step is to allow editing and have a full ship detail page (the main page is just a list of your ships. An ugly list at the moment...)
I also updated VS2017 to the latest version and few other things, but now progress in theory should be a tad faster as I think I've got basic I/O in place.
And I learned a bit more about DB migrations. This is a code-first program, meaning the DB is basically defined in the code, and we use migrations to update the database. So the 1st migration just sets up the ship table, and you can see how ShipID is the primary key.
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using TravellerTracker.Models;
namespace TravellerTracker.Migrations
{
[DbContext(typeof(TravellerContext))]
[Migration("20170416155153_initialShip")]
partial class initialShip
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.1");
modelBuilder.Entity("Traveller.Models.Ship", b =>
{
b.Property
.ValueGeneratedOnAdd();
b.Property
b.Property
b.Property
b.Property
b.Property
b.HasKey("ShipId");
b.ToTable("Ships");
});
}
}
}
No comments:
Post a Comment