Entities: Use 'required' and '= null!' to get rid of warnings
This commit is contained in:
@ -2,7 +2,6 @@ using Elwig.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
|
||||
namespace Elwig.Models.Entities {
|
||||
[Table("area_commitment"), PrimaryKey("FbNr")]
|
||||
@ -14,7 +13,7 @@ namespace Elwig.Models.Entities {
|
||||
public int MgNr { get; set; }
|
||||
|
||||
[Column("vtrgid")]
|
||||
public string VtrgId { get; set; }
|
||||
public required string VtrgId { get; set; }
|
||||
|
||||
[Column("cultid")]
|
||||
public string? CultId { get; set; }
|
||||
@ -26,7 +25,7 @@ namespace Elwig.Models.Entities {
|
||||
public int KgNr { get; set; }
|
||||
|
||||
[Column("gstnr")]
|
||||
public string GstNr { get; set; }
|
||||
public required string GstNr { get; set; }
|
||||
|
||||
[Column("rdnr")]
|
||||
public int? RdNr { get; set; }
|
||||
@ -41,25 +40,24 @@ namespace Elwig.Models.Entities {
|
||||
public string? Comment { get; set; }
|
||||
|
||||
[ForeignKey("MgNr")]
|
||||
public virtual Member Member { get; private set; }
|
||||
public virtual Member Member { get; private set; } = null!;
|
||||
|
||||
[ForeignKey("VtrgId")]
|
||||
public virtual AreaComType AreaComType { get; private set; }
|
||||
public virtual AreaComType AreaComType { get; private set; } = null!;
|
||||
|
||||
[ForeignKey("CultId")]
|
||||
public virtual WineCult? WineCult { get; private set; }
|
||||
|
||||
[ForeignKey("KgNr")]
|
||||
public virtual WbKg Kg { get; private set; }
|
||||
public virtual WbKg Kg { get; private set; } = null!;
|
||||
|
||||
[ForeignKey("KgNr, RdNr")]
|
||||
public virtual WbRd? Rd { get; private set; }
|
||||
|
||||
public int SearchScore(IEnumerable<string> keywords) {
|
||||
var list = new string?[] {
|
||||
WineCult?.Name, Kg.AtKg.Name, Rd.Name, GstNr, Comment,
|
||||
}.ToList();
|
||||
return Utils.GetSearchScore(list, keywords);
|
||||
return Utils.GetSearchScore([
|
||||
WineCult?.Name, Kg.AtKg.Name, Rd?.Name, GstNr, Comment,
|
||||
], keywords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user