Setup CSV Fleet import and EF Fleet Entity, fix a few bugs
This commit is contained in:
		@@ -1,10 +1,15 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
using System.ComponentModel.DataAnnotations.Schema;
 | 
			
		||||
 | 
			
		||||
namespace StarsAssistant.Model;
 | 
			
		||||
 | 
			
		||||
public class Fleet
 | 
			
		||||
{    
 | 
			
		||||
{
 | 
			
		||||
    [Key]
 | 
			
		||||
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 | 
			
		||||
    public int Id { get; set; }
 | 
			
		||||
 
 | 
			
		||||
    #region Persistant propeties (from Stars)
 | 
			
		||||
 | 
			
		||||
    public string FleetName { get; set; } = String.Empty;
 | 
			
		||||
@@ -31,7 +36,9 @@ public class Fleet
 | 
			
		||||
 | 
			
		||||
    public int Fuel { get; set; }
 | 
			
		||||
 | 
			
		||||
    public int OwnerPlayerNumber { get; set; }
 | 
			
		||||
    public string OwnerId { get; set; } = String.Empty;
 | 
			
		||||
 | 
			
		||||
    public int OwnerFileId { get; set; }
 | 
			
		||||
 | 
			
		||||
    public int ETA { get; set; }
 | 
			
		||||
 | 
			
		||||
@@ -66,4 +73,10 @@ public class Fleet
 | 
			
		||||
    public int Bomber { get; set; }
 | 
			
		||||
 | 
			
		||||
    #endregion
 | 
			
		||||
 | 
			
		||||
    #region Relationships
 | 
			
		||||
 | 
			
		||||
    public Race? Owner { get; set; }
 | 
			
		||||
 | 
			
		||||
    #endregion
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,9 @@ public class Race
 | 
			
		||||
 | 
			
		||||
    #region Relationships
 | 
			
		||||
 | 
			
		||||
    public ICollection<Planet> Planets { get; } = new List<Planet>();
 | 
			
		||||
    public ICollection<Planet> Planets { get; set; } = [];
 | 
			
		||||
 | 
			
		||||
    public ICollection<Fleet> Fleets { get; set; } = [];
 | 
			
		||||
 | 
			
		||||
    #endregion
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -29,15 +29,18 @@ public class StarsDatabase(string DbPath) : DbContext
 | 
			
		||||
 | 
			
		||||
    #endregion
 | 
			
		||||
 | 
			
		||||
    #region IStarsDatabase Implementation
 | 
			
		||||
 | 
			
		||||
    public DbContext DbContext => this;
 | 
			
		||||
    #region DbSets
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// List of all Planets read.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public DbSet<Planet> Planet { get; set; }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// List of all Fleets read.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public DbSet<Fleet> Fleet { get; set; }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Lists of all defined races.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user