Jeroen E
Jeroen E

Reputation: 57

How stable is Orc.EntityFrameworkCore

I'm currently working on a WPF project with .NET 5.0 using Catel 5.12.19 and Microsoft.EntityFrameworkCore 5.0.11.

For the EF part I use a code first approach.

When setting up everything using this catel documentation I noticed the necessary extensions are moved to Orc.EntityFramework, but this supports EF 6 and up only.

For EF Core I find Orc.EntityFrameworkCore but only as Alpha versions.

I wondered how stable this is, anyone expercienes?

I'm specifically looking to the .IgnoreCatelProperties() extension

Jeroen

Upvotes: 0

Views: 60

Answers (1)

Jeroen E
Jeroen E

Reputation: 57

For now it seems sufficient to add the following Ignores to the OnModelCreating

public class Model : DbContext
{

    public Model() : base() { }

    public Model(DbContextOptions<Model> options) : base(options) { }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        new CustomersEntityTypeConfiguration()
            .Configure(modelBuilder.Entity<Customers>()
            .Ignore("IsDirty")
            .Ignore("IsReadOnly")
            );
    }
    public DbSet<Customers> Customers { get; set; }
}

public class CustomersEntityTypeConfiguration : IEntityTypeConfiguration<Customers>
    {
        public void Configure(EntityTypeBuilder<Customers> builder)
        {
            builder                                    
                .Property(c => c.ID)                
                .IsRequired();
        }
    }

Upvotes: 0

Related Questions