Eff, Aff and Entity Framework Core #1191
timmi-on-rails
started this conversation in
Ideas
Replies: 1 comment
-
@timmi-on-rails I think it depends a little on what operations you are supporting in your static Database module. Would you be able to share a little bit of that? Some things that I tend to need are,
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am experimenting with adopting the
Runtime
approach (https://github.com/louthy/language-ext/wiki/How-to-deal-with-side-effects) in an Entity Framework Core project.So far I have a demo project together with a library and code generation (source generators) project.
I am interested in your opinions before going further.
As starting point, here is some regular EF Core code for a table of products:
Now comes the new thing.
As an example we create a database initialization routine:
The class
Demo.GeneratedAppDbContext
is auto-generated from theAppDbContext
and itsDbSet
s.The trait
HasDbContext
is new and actually, together with the runtimeRT
, the only thing that has to be implemented by hand.So here is the trait:
The trait implementation is simple:
That's it!
I don't want to explain the details of the implementation, yet.
And there are a lot of minor decisions to make, before this should go online.
But I hope the basic idea has become clear.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions