-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Interface to formalize how tooling obtains the application's service provider #2342
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
Comments
From @davidfowl on Tuesday, May 2, 2017 7:53:12 PM I don't see what this has to do with DI. Are we just looking for a place to put an interface? |
From @DamianEdwards on Tuesday, May 2, 2017 7:55:12 PM Sure, where should we put it? |
From @davidfowl on Tuesday, May 2, 2017 7:58:37 PM Honestly, I don't understand what this solves... Are we going to have shared code that calls into this interface or something? |
From @divega on Tuesday, May 2, 2017 10:37:12 PM Not necessarily, but yes we could. As the title says and hopefully the description explains this interface formalizes the convention that tools need to implement in order to obtain the application's service provider at design time. E.g. instead of having to fake a host and instantiate The main affinity with DI is that it is about obtaining the |
From @ericwj on Monday, May 15, 2017 3:49:15 PM It is an interesting idea for Universal apps as well. There is always the problem of being unable to instantiate ViewModels at design time which have constructor arguments that are meant to come from DI at runtime. Everybody goes about crafting a solution, and they aren't always pretty. Sometimes they're awful. This isn't about 'tooling' per se, not in the .NET Core sense, but how cool would it be if XDesProc could use this? Well, phase one would be me using this with if (DesignModeEnabled)... |
From @Eilon on Monday, May 15, 2017 4:28:27 PM @divega @davidfowl @ajcvickers @DamianEdwards @muratg @bricelam - what is the status of this? We met last week, and I thought maybe we arrived at a conclusion, but I don't recall the concrete next steps. Whatever we decide, we should try to get it in this week. |
From @ajcvickers on Monday, May 15, 2017 4:32:25 PM @Eilon Diego, Brice, and I talked about it a little while ago. Brice is going to send some pull requests and we will take it from there. |
From @ericwj on Tuesday, May 16, 2017 5:39:07 AM Can you comment a bit on bringing some UI folks onboard? Xamarin, UWP? Is this something you see benefit in? Or should I raise this issue in a few other places? |
From @ericwj on Tuesday, May 16, 2017 12:36:55 PM No, not today, but behold, .NET Standard is coming. I don't think there is mention of a date for UWP to arrive at 2.0, but once it's there, it'll make quite an impact I'm sure. Sharing basics like this just removes friction and making switching project types less of a culture shock. And it'd be opt in anyway I'm sure... I've tried to find a suitable repo for XAML, but I couldn't really find one. Can you direct me somewhere, or should I use |
From @bricelam on Tuesday, May 16, 2017 12:58:44 PM VS Feedback would be a good place to start. Maybe dotnet/project-system would also get the right people looking at it. |
From @ericwj on Tuesday, May 16, 2017 1:13:15 PM And Xamarin? They don't have issues. Only pull requests 🥇 |
From @bricelam on Tuesday, May 16, 2017 1:21:23 PM Sorry, no idea on that one |
From @ericwj on Tuesday, May 16, 2017 1:22:37 PM TY anyway, I'll get there |
From @divega on Friday, May 19, 2017 10:02:46 AM Clearing up milestone so that this can be re-triaged. We are not planning to do it for 2.0.0. Also some relevant comments in the conversation on the PR: aspnet/DependencyInjection#527 (comment). |
From @divega on Monday, October 23, 2017 11:26:19 PM @muratg I think it is fine for this to be in the backlog. It still seems nice and from time to time we hear from people that want something that works with DI without ASP.NET Core and without going all the way down to Cc @bricelam and @ajcvickers in case they think we should plan to have it sooner. |
@divega Do you think we still need this? I'm going to close this out since we have something else that seems to be working fine. Come talk to me if you really really want it 😄 |
Because read-only streams apparently can have Flush semantics and this behavior is expected by some of built-in stream wrappers (e. g. CryptoStream) dotnet/corefx#27327 (review) aspnet/KestrelHttpServer#2341
From @divega on Tuesday, May 2, 2017 5:16:21 PM
This a more general purpose alternative to the feature described in dotnet/efcore#8331.
Currently tools that require access to the application's runtime services and configuration (e.g. EF Core tools, ASP.NET Core Scaffolding, possibly Razor tooling and others) need to hardcode heuristics which
Startup.ConfigureServices()
in ASP.NET Core 1.0,Program.BuildWebHost()
in ASP.NET Core 2.0, etc.)IDbContextFactory
in EF) if the convention is not matchedThis issue is about defining a common accessor interface that tooling can scan for at design time which provides access to the application's service provider. We believe this approach:
Program.BuildWebHost(args).Services
. If the mechanism changes in the future, the template can be updatedDbContext
registered withAddDbContext
regardless of their location, makingIDbContextFactory
unnecessary for most common casesExample:
Open issues:
cc @bricelam @ajcvickers @DamianEdwards @davidfowl
Copied from original issue: aspnet/DependencyInjection#524
The text was updated successfully, but these errors were encountered: