Files
Heimdall/src/Heimdall.Infrastructure/Data/Configurations/CameraCredentialsConfiguration.cs
T

39 lines
1.1 KiB
C#
Raw Normal View History

using Heimdall.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Heimdall.Infrastructure.Data.Configurations;
public class CameraCredentialsConfiguration : IEntityTypeConfiguration<CameraCredentials>
{
public void Configure(EntityTypeBuilder<CameraCredentials> builder)
{
builder.ToTable("camera_credentials");
builder.HasKey(c => c.CameraId);
builder.Property(c => c.OnvifUsername)
.HasMaxLength(100)
.HasDefaultValue("admin")
.IsUnicode(false);
builder.Property(c => c.OnvifPassword)
.HasMaxLength(500)
.IsRequired()
.IsUnicode(false);
builder.Property(c => c.RtspUsername)
.HasMaxLength(100)
.IsUnicode(false);
builder.Property(c => c.RtspPassword)
.HasMaxLength(500)
.IsUnicode(false);
builder.Property(c => c.CreatedAt)
.HasDefaultValueSql("NOW()");
builder.Property(c => c.UpdatedAt)
.HasDefaultValueSql("NOW()");
}
}