Path: redb/redb.Core/Models/Entities/RedbUserRole.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Models/Entities/RedbUserRole.cs
----
using redb.Core.Models.Contracts;
using System.Text.Json.Serialization;
namespace redb.Core.Models.Entities
{
///
/// REDB user-role association entity with direct data storage.
/// Maps to _users_roles table in PostgreSQL.
///
public class RedbUserRole : IRedbUserRole
{
///
/// Unique association identifier.
///
[JsonPropertyName("id")]
public long Id { get; set; }
///
/// Role identifier.
///
[JsonPropertyName("id_role")]
public long IdRole { get; set; }
///
/// User identifier.
///
[JsonPropertyName("id_user")]
public long IdUser { get; set; }
///
/// Default constructor for deserialization and mapping.
///
public RedbUserRole()
{
}
///
/// Constructor with user and role IDs.
///
public RedbUserRole(long idUser, long idRole)
{
IdUser = idUser;
IdRole = idRole;
}
public override string ToString()
{
return $"UserRole {Id}: User {IdUser} -> Role {IdRole}";
}
}
}