I have not found a solution yet without having to modify the Umbraco code. I'm doing some testing. The problem to create the mappings is to create at the time of UmbracoDatabase Setup. I got to making modifications to the source code. I'm seeing a way to do this after the setup or I'll open a PR with the solution I did by changing the source code.
Briefly looked at our code in UmbracoDatabaseFactory and indeed it does not really support adding more mappers and / more tweaking the configuration.
I'm totally fine with extending it so that we make it more open.
I am not entirely sure what is the best way to do it, though. Maybe make our own UmbracoDatabaseFactory class public with some virtual extension points, would allow ppl to subclass it - but the factory is not resolved via the normal composers concept, because it needs to be resolved way earlier in the boot process. It is created by CoreRuntime.GetDatabaseFactory so ppl would have to also override the runtime, which means overriding the application base (in global.asax)... not so simple.
NPoco Fluent Mappings and Performing operations during Poco events with Umbraco 8
I use NPoco a lot of time and always set up the Pocos using fluent mappings. This mapping runs in DatabaseFactory:
https://github.com/schotime/NPoco/wiki/Fluent-Mappings-including-Conventional
Also how is it possible to use interceptors.
https://github.com/schotime/NPoco/wiki/Performing-Operations-during-Poco-events-(Insert,-Update,-etc)
How would that be at Umbraco?
I made a few attempts using IUserComposer but all failed
Hi Marcio
Did you find a solution? Can you share with our community?
Thanks,
Alex
Hi Alex,
I have not found a solution yet without having to modify the Umbraco code. I'm doing some testing. The problem to create the mappings is to create at the time of UmbracoDatabase Setup. I got to making modifications to the source code. I'm seeing a way to do this after the setup or I'll open a PR with the solution I did by changing the source code.
I modify this part of code https://github.com/umbraco/Umbraco-CMS/blob/853087a75044b814df458457dc9a1f778cc89749/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs#L216
Briefly looked at our code in
UmbracoDatabaseFactory
and indeed it does not really support adding more mappers and / more tweaking the configuration.I'm totally fine with extending it so that we make it more open.
I am not entirely sure what is the best way to do it, though. Maybe make our own
UmbracoDatabaseFactory
class public with some virtual extension points, would allow ppl to subclass it - but the factory is not resolved via the normal composers concept, because it needs to be resolved way earlier in the boot process. It is created byCoreRuntime.GetDatabaseFactory
so ppl would have to also override the runtime, which means overriding the application base (in global.asax)... not so simple.Happy to hear about other ideas.
Did you make progress on this? Is there a GitHub issue?
Just wondering did anybody achieve this?
is working on a reply...