Suppose I have the following data model:
public class Base {
public int Id { get; set; }
public string Name { get; set; }
}
and the following OnModelCreating()
:
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
modelBuilder.Entity<Base>()
.Property(b => b.Name)
.IsRequired()
.HasMaxLength(32);
}
Is detection of the use of Entity Framework's fluent API possible either at compile or run time? In pseudo-code I would like to do something like:
for a given Base
detect that Name is required and must be <= 32 characters
act upon that information
For context, I am attempting to generate pseudorandom POCOs that conform to the restrictions placed on it by data annotations or the fluent API. Data annotations are simple enough, but I haven't figure out a way to act on the fluent API use.