Skip to content

maxbeaudoin/MagicDbModelBuilder

Repository files navigation

MagicDbModelBuilder is a set of wrapper classes that enable the creation/configuration of models at runtime
through reflection. A feature that Entity Framework does not support, for now.

What you could do:

var builder = new DbModelBuilder();
builder.Entity<Post>()
  .HasKey(p => p.Id);

... what you couldn't do:

var builder = new DbModelBuilder();
builder.Entity(typeof(Post))
  .HasKey(typeof(Guid), "Id");

... or ...

builder.Entity(typeof(Post))
  .Property(typeof(int), "Id")
  .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

... or ...

builder.Entity(typeof(Post))
  .DateTimeProperty("ModifiedOn", true) // supports nullable with optional parameter 'nullable' set to true 
  .IsRequired();

More implementations to come...

About

Entity Framework support for building model at runtime

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages