codemillmatt / codemill.vmfirstnav

Xamarin.Forms ViewModel First Navigation Library
MIT License
22 stars 5 forks source link

Public constructor for IoC #6

Closed codemillmatt closed 7 years ago

codemillmatt commented 7 years ago

Should there be a public constructor so this can work with IoC frameworks? (Will probably cause a dissonance & issues with the singleton pattern approach.)

zirkelc commented 7 years ago

Do you have an example? Sometimes, IoC frameworks support Func's to retrieve an instance or register an instance (and therefore a Singleton). For example, see: http://caliburnmicro.com/documentation/simple-container

ionixjunior commented 7 years ago

Autofac can also work this way http://docs.autofac.org/en/latest/lifetime/instance-scope.html#single-instance

codemillmatt commented 7 years ago

I've changed my mind on the public constructor 😄. You all are right, all one would need to do is register the existing singleton with the IoC & be done with it. Whether it's via a func or the singleton instance directly. (Or am I missing something?)

I think the most important thing to do would be to provide some examples of how it works w/ various IoC's Caliburn or AutoFac...

Anyway, unless @chriszirkel or @ionixjunior object, I'm going to close this issue and then create a new one for "how to use with IoC" documentation.

codemillmatt commented 7 years ago

Closing this and will add a new issue for documentation