Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject the IStore.IConfiguration into the DI to make it modifiable #14959

Closed
hyzx86 opened this issue Dec 27, 2023 · 6 comments
Closed

Inject the IStore.IConfiguration into the DI to make it modifiable #14959

hyzx86 opened this issue Dec 27, 2023 · 6 comments

Comments

@hyzx86
Copy link
Contributor

hyzx86 commented Dec 27, 2023

Hi @MikeAlhayek ,

Are there any problems if we inject this configuration into DI?
I'm trying to implement dynamic indexing sebastienros/yessql#521

So I need to change the Store.Configuation

https://github.com/OrchardCMS/OrchardCore/blob/f477647f067ad68701a3ae26e0d41419fa1526db/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs#L66C33-L66C33

@hishamco
Copy link
Member

I think this needs to be moved into YesSQL repo

So I need to change the Store.Configuation

Why?

@hyzx86
Copy link
Contributor Author

hyzx86 commented Dec 27, 2023

Just open up some Configuation for developers to change,
The current configuration information is a bit closed,
And if you haven't noticed, Yessql's ORM capabilities are weak, so I'd like to make some enhancements in this feature

@hyzx86
Copy link
Contributor Author

hyzx86 commented Dec 27, 2023

I think this needs to be moved into YesSQL repo

Yes , here sebastienros/yessql#521

And I remember that improvement suggestion you were talking about. Why didn't I find...
Because I'm not on the project?

@MikeAlhayek
Copy link
Member

@hyzx86 if you want to change the configurations of YesSQL in your project, you may do so by configuring YesSqlOptions.

If you need to access the configuration, you can do so by injection an ISession and access it like this _session.Store.Configuration

If you want to suggest improvements to YesSql, you may file and issue and follow it with PR in the YesSQL repository.

@hyzx86
Copy link
Contributor Author

hyzx86 commented Dec 27, 2023

I saw that type, but it constrained me to configure Yessql freely when testing dynamic indexes.
My solution is based on OC, but it relies on third-party components such as FreeSql (for generating dynamic index types and index data).

Actually going back to the original idea, I just wanted to implement a method like this

public class PropertyIndexProvider : IndexProvider<Property>
{
    public override void Describe(DescribeContext<ContentItem> context)
    {
       Type myType= getMyType(contentItem);
        context
            .For(myType)// make here support dynamic type
            .Map(property =>{
                        var indexObj= getIndexModel(property)
                        return indexObj;//object 
              });
    }
}

The Yessql code is a bit complicated, and I'm trying to figure out the logic

@hyzx86
Copy link
Contributor Author

hyzx86 commented Dec 28, 2023

Use another solution sebastienros/yessql#525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants