I have a model that I want to load one of its columns from a source other than the database behind EF Core for example MongoDb.
The problem is that I can't figure how to override query execution in EF Core. For Saves it's OK because EF Core lets us to override SaveChanges and do our own logic.
For the read part, I decided to load the column lazily through its getter accessor. The goal is to have as little as possible change in our code (We have lots of projects that uses EF Core to load the object and I don't want to change code in a way that breaks all queries of that specific object).
But how to inject my MongoDb service to my model? For ASP.Net Core, we can create a custom model binder but for EF Core how to have a custom model binder or model creator to inject services to model? Can I use dependency injectors like Ninject or AutoFac (I just heard about them and don't have any experience with them)? Do they work with EF Core?
Your design is fundamentally broken. EF Core is an ORM for relational databases, and specifically can only natively work with one database per context. Composing from multiple data sources is not something you should be doing through EF Core code, but rather through some sort of service class that internally utilizes EF Core and the MongoDB driver. Your app code should, then utilize this service, and not EF Core directly. It is 100% the wrong approach to trying to hack this into your context code.