Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Rename AddInstance to AddSingleton #319

Closed
Eilon opened this issue Nov 5, 2015 · 4 comments
Closed

Rename AddInstance to AddSingleton #319

Eilon opened this issue Nov 5, 2015 · 4 comments
Assignees
Milestone

Comments

@Eilon
Copy link
Member

Eilon commented Nov 5, 2015

The name AddInstance doesn't make it super clear what the lifetime is of the object. (If you stop and think about it, it can only be Singleton, but every time I call that method I have to stop and think about it.)

So, we should rename AddInstance to AddSingleton, or perhaps AddSingletonInstance.

@Eilon
Copy link
Member Author

Eilon commented Nov 5, 2015

@lodejard @davidfowl @halter73 thoughts on the name?

@lodejard
Copy link
Contributor

lodejard commented Nov 6, 2015

Is there an overload where the only difference would be between Type and Object? If that's okay any naming works for me

@pranavkm
Copy link
Contributor

pranavkm commented Nov 6, 2015

Makes the 3 scenarios line up:

AddSingleton<IService, MyService>();

AddSingleton<IService>(serviceProvider => new MyService(serviceProvider));

AddSingleton<IService>(new MyService());

@halter73
Copy link
Member

halter73 commented Nov 6, 2015

I'm sold.

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

No branches or pull requests

5 participants