Skip to main content

Overview

The Jugador (Player) entity represents a football player in the tournament management system. Each player belongs to a team, has a playing position, and wears a unique jersey number within their team.

Properties

int
Unique identifier for the player.
string
required
Full name of the player.Validation Rules:
  • Required field (cannot be empty)
  • Must contain only letters and spaces
  • Cannot consist of numbers only
  • Minimum length: 3 characters
  • Maximum length: 50 characters
  • Regex pattern: ^(?![0-9]+$)[a-zA-ZÀ-ÿ\s]+$
Display Name: “Nombre del Jugador”Error Messages:
  • Pattern mismatch: “Valor Incorrecto. Solo se permiten letras”
  • Required: “El nombre del Jugador es obligatorio.”
  • Max length: “El nombre del jugador no puede contener más de 50 caracteres”
  • Min length: “El nombre del jugador no puede contener menos de 3 caracteres”
int
required
Jersey number of the player.Validation Rules:
  • Required field
  • Must contain only numeric values
  • Minimum value: 1
  • Maximum value: 99
  • Regex pattern: ^(?!a-zA-Z+$)[0-9]+$
Display Name: “Número del Jugador”Error Messages:
  • Pattern mismatch: “Valor Incorrecto. Solo se permiten numeros”
  • Required: “El Número del Jugador es obligatorio.”
  • Range: “El Número del Jugador debe estar en un rango entre 1 y 99”
Equipo?
The team the player belongs to.Nullable: YesRelationship: Many-to-One (Many players belong to one team)Related Entity: Equipo
Posicion?
The playing position of the player.Nullable: YesRelationship: Many-to-One (Many players can have the same position)Related Entity: Posicion

Relationships

The Jugador entity has two important many-to-one relationships:

Team (Equipo)

Equipo
Each player belongs to one team. This is a many-to-one relationship where multiple players are associated with a single team.Navigation Property: EquipoRelated Entity: EquipoCardinality: Many players to one team

Position (Posicion)

Posicion
Each player has one playing position (e.g., Forward, Midfielder, Defender, Goalkeeper). Multiple players can share the same position.Navigation Property: PosicionRelated Entity: PosicionCardinality: Many players to one position

Validation Attributes

The Jugador entity uses the following Data Annotations:
  • [Required] - Ensures name and number are mandatory
  • [RegularExpression] - Validates name (letters only) and number (digits only) formats
  • [MaxLength] / [MinLength] - Enforces name character length constraints
  • [Range] - Ensures jersey number is between 1 and 99
  • [Display] - Provides user-friendly display names
  • [DisplayFormat] - Configures empty string handling
The jersey number validation ensures realistic football jersey numbers (1-99), which is standard in most football leagues.

Code Examples

Entity Definition

Creating a Player

Creating Multiple Players

Valid Examples

Invalid Examples

These examples will fail validation:

Querying Players

Updating Player Information

Jersey Number Uniqueness

While the entity validation ensures numbers are between 1-99, additional business logic may be needed to ensure jersey numbers are unique within a team.

Common Use Cases

Squad Management

Player Statistics

Database Mapping

The Jugador entity is mapped to a database table with the same name. The Id property serves as the primary key and is auto-generated.Foreign keys are created for:
  • Equipo relationship (EquipoId)
  • Posicion relationship (PosicionId)