❔ Make Entity Framework Property Unique

namespace Textopia.Models;

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

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

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

    public ICollection<User>? Users { get; set; }
    public ICollection<Post>? Posts { get; set; }
}


How can I make slugs unique!?
Was this page helpful?