Implement BuCol

This commit is contained in:
2024-09-24 22:32:13 +02:00
parent 800dcf23ba
commit efa5d452ea
8 changed files with 188 additions and 35 deletions

View File

@ -5,12 +5,12 @@ namespace StarsAssistant.Model;
public class Planet
{
#region Persistant and derived propeties
#region Persistant propeties
[Key]
public required string Name { get; set; }
public string? OwnerId { get; set; }
public string OwnerId { get; set; } = String.Empty;
public string StarbaseType { get; set; } = String.Empty;
@ -70,7 +70,7 @@ public class Planet
public int? DriverWarp { get; set; }
public string? RouteTarget { get; set; }
public string RouteTarget { get; set; } = String.Empty;
public int? GateRange { get; set; }
@ -86,22 +86,4 @@ public class Planet
#endregion
#region Derived Properties
// public int EffectiveValue() => EffectiveValue(Value);
// public int MaxPopOnPlanet() => MaxPopOnPlanet(Value);
// public int PopGrowth() => PopGrowth(Population ?? 0, MaxPopOnPlanet(), Value ?? 0);
// public int MaxFact() => MaxFact(Population ?? 0);
// public int MaxMines() => MaxMines(Population ?? 0);
// public int ResourcesFromPop() => ResourcesFromPop(Population ?? 0, Value ?? 0);
// public int ResourcesFromFact() => ResourcesFromFact(Population ?? 0, Factories ?? 0, Value ?? 0);
#endregion
}

View File

@ -18,6 +18,15 @@ public class StarsDatabase(string DbPath) : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
/// <summary>
/// Configure the model, force it to use property accessors we define.
/// </summary>
/// <param name="modelBuilder">model builder</param>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.UsePropertyAccessMode(PropertyAccessMode.Property);
}
#endregion
#region IStarsDatabase Implementation