You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the ICompileModule feature provided by the DNX, would it be possible to provide the ability to create a compile time instance of Model where the properties of the model are statically added through compile-time code generation?
E.g. using a PreCompileDatabaseModelCompileModule (ala Razor's pre-compilation compile model), that takes the target compilation, finds an non-abstract DbContext derivatives (potentially with a [PreCompile] opt-in attribute), and generate a class at runtime, something like:
public class Model<TContext> : IModel, IModel<TContext> { }
Would it then be possible for EF to scan for instances of IModel<TContext>, create the instance and inject through DbContextOptions.UseModel(model)?
I'm just wondering that as the database model is immutable once the DB context is created, is their a benefit of offloading the model builder and verification tasks to compile time instead of runtime?
Probably no small task, and probably more for chasing absolute start-up performance and efficiencies.
The text was updated successfully, but these errors were encountered:
With the
ICompileModule
feature provided by the DNX, would it be possible to provide the ability to create a compile time instance ofModel
where the properties of the model are statically added through compile-time code generation?E.g. using a
PreCompileDatabaseModelCompileModule
(ala Razor's pre-compilation compile model), that takes the target compilation, finds an non-abstract DbContext derivatives (potentially with a[PreCompile]
opt-in attribute), and generate a class at runtime, something like:Would it then be possible for EF to scan for instances of
IModel<TContext>
, create the instance and inject throughDbContextOptions.UseModel(model)
?I'm just wondering that as the database model is immutable once the DB context is created, is their a benefit of offloading the model builder and verification tasks to compile time instead of runtime?
Probably no small task, and probably more for chasing absolute start-up performance and efficiencies.
The text was updated successfully, but these errors were encountered: