birbmap/Birdmap.DAL/Entities/Configurations/ServiceConfiguration.cs

24 lines
667 B
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
namespace Birdmap.DAL.Entities.Configurations
{
public class ServiceConfiguration : IEntityTypeConfiguration<Service>
{
public void Configure(EntityTypeBuilder<Service> builder)
{
builder.Property(s => s.Name)
.IsRequired();
builder.Property(s => s.Uri)
.HasConversion(u => u.ToString(), u => new Uri(u))
.IsRequired();
2020-10-31 15:57:19 +01:00
builder.Property(s => s.IsFromConfig)
.HasDefaultValue(false)
.IsRequired();
}
}
}