Generalize plugin logic #736
Replies: 3 comments 9 replies
-
well crap i see that it might already be there .... so this may be a done thing.... oh heck! |
Beta Was this translation helpful? Give feedback.
-
This is 100% possible. I built a system for my company that does exactly this. It is a set of Managers that allow objects that inherit from a specific type and conform to specific interfaces to be modified correctly without the need for extra code. We then created a manual code generator to route Restier calls through those Managers, allowing you to include additional functionality through partial methods. The sum total of that system allows you to run the exact same business logic whether you need to interact with the database more directly (like in complex Restier Operations) or call Restier through the web. This is how we're able to build and evolve BurnRate so quickly (https://dotnet.microsoft.com/en-us/platform/customers/burnrate) My next goal is to turn the manual code generator into a Roslyn Source Generator so that the code just always stays updated. I would like to productize it sometime in 2024, but that depends on a number of factors. HTH! |
Beta Was this translation helpful? Give feedback.
-
one other thing that perhaps you can point out to me: |
Beta Was this translation helpful? Give feedback.
-
i like the current support for adding logic with the On<Update|Insert|Delete>()
but what about some thing more like this as an option
OnInsert( item) where T impliments interface IRecord
that is not exactly the right syntax ....
the idea is that if i have adatabase with say 20 tables that all have some comon colums like date created, date changed , who updated and who created that all of the ef models could impliment an interface IRecord
if the item to be updated is compatable with IRecord then i can apply an OnUpdate function generically to all the entities that impliment that interface.
so in place of having to create 20 OnUpdateing functions i create one that works for all of them.
i hope the idea is explained well enough here for others to see how this might work and be very usefull.
Beta Was this translation helpful? Give feedback.
All reactions