❔ Setting up a One-To-Many-Relationship in EntityFramework Core

namespace GetOut.Models;

public class Provider(string slug, string name, string? description)
{
    public Guid Id { get; set; } = Guid.NewGuid();

    public DateTime CreatedAt { get; set; } = DateTime.Now;
    public DateTime UpdatedAt { get; set; } = DateTime.Now;
    public DateTime? DeletedAt { get; set; }

    public string Slug { get; set; } = slug;
    public string Name { get; set; } = name;
    public string? Description { get; set; } = description;
    
    public bool Verified { get; set; } = false;

    public City City { get; set; }
    public ICollection<Event>? Events { get; set; }
}


I want to establish a relation between Providers and City. 😉 Thanks.
Was this page helpful?