Provides a default set of tools for EntityFramework.
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Entities
{
sealed class Test
{
public Guid TestId { get; set; }
public string Name { get; set; }
public int Factor { get; set; }
public string Spaced { get; set; }
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace qckdev.Data.EntityFrameworkCore.Test.Configuration
{
sealed class TestConfiguration : IEntityTypeConfiguration<Entities.Test>
{
public void Configure(EntityTypeBuilder<Entities.Test> builder)
{
builder.HasKey(x => x.TestId);
builder.Property(x => x.Spaced).HasMaxLength(20).IsFixedLength().TrimEnd();
}
}
}