Overview
TheJugador (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
Unique identifier for the player.
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]+$
- 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”
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]+$
- 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”
The team the player belongs to.Nullable: YesRelationship: Many-to-One (Many players belong to one team)Related Entity: Equipo
The playing position of the player.Nullable: YesRelationship: Many-to-One (Many players can have the same position)Related Entity: Posicion
Relationships
TheJugador entity has two important many-to-one relationships:
Team (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 teamPosition (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 positionValidation Attributes
TheJugador 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
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:Equiporelationship (EquipoId)Posicionrelationship (PosicionId)
Related Entities
- Equipo - Team the player belongs to
- Posicion - Player’s position on the field
- DirectorTecnico - Team’s technical director (indirect)
- Municipio - Municipality of the team (indirect)