reactiveui / splat

Makes things cross-platform
MIT License
967 stars 142 forks source link

How to Use Splat.DI.SourceGenerator #841

Closed mysteryx93 closed 2 years ago

mysteryx93 commented 2 years ago

Avalonia comes with ReactiveUI and ReactiveUI comes with Splat. I'm trying to use those default tools.

What bugs me off is that Splat by default needs to manually create each object. Splat.DI.SourceGenerator is supposed to solve that problem.

Now in my project I have Avalonia.ReactiveUI and Splat.DI.SourceGenerator

SplatRegistrations is not recognized. I find no way to use this.

SplatRegistrations.Register<IMenuUseCase, MenuUseCase>();
SplatRegistrations.Register<IOtherDependency, OtherDependency>();

I spent several hours trying to get this to work. What am I missing?

Besides the troubles to get this setup; what are the benefits of going the Splat route vs some more established DI containers like Microsoft DI or Simple Injector?

glennawatson commented 2 years ago

This is not the splat di source generator repo.

glennawatson commented 2 years ago

https://github.com/reactivemarbles/Splat.DI.SourceGenerator

GitHub
GitHub - reactivemarbles/Splat.DI.SourceGenerator
Contribute to reactivemarbles/Splat.DI.SourceGenerator development by creating an account on GitHub.
glennawatson commented 2 years ago

I would transfer the issue but it's in another organisation

glennawatson commented 2 years ago

When you do open the issue in the other repo can you include the ide you are using, your csproj file.

Thanks

mysteryx93 commented 2 years ago

It's a separate organization -- so this isn't even supported at all by Splat? Isn't the whole point of Dependency Injection to take care of the object initialization tree? Just trying to understand the logic here.

glennawatson commented 2 years ago

Marbles is the rxui incubation program. It's getting moved sooner rather than later into the main project.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.