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

How to use this with multiple projects using the HostingStartup attribute? #6

Open
YodasMyDad opened this issue Dec 6, 2018 · 0 comments

Comments

@YodasMyDad
Copy link
Contributor

Have a look here for info on the new HostingStartup attribute

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/platform-specific-configuration?view=aspnetcore-2.2

In short, I have several projects within a solution that all use this as (to me) it's a great way to add startup code to separate projects. I have a X.Core project where I'd like to setup the framework like below.

        // Add the Commanding Framework
        var adapter = new CommandingDependencyResolverAdapter(
            (fromType, toInstance) => services.AddSingleton(fromType, toInstance),
            (fromType, toType) => services.AddTransient(fromType, toType),
            resolveTo => _serviceProvider.GetService(resolveTo));
        var registry = adapter.AddCommanding();

Then need a way of getting the ICommandRegistry via the IWebHostBuilder builder I guess, so I can register query handlers from the other projects.

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

1 participant