This repository has been archived by the owner on Nov 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
Dependency injection for Application #401
Comments
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
-->Can you pass in a subclass of ApplicationOptions to the ctor?(that’s what I do, but not sure for winforms..) Sent from Mail for Windows 10 From: HaukingerSent: 14 June 2020 16:23To: xamarin/urhoCc: SubscribedSubject: [xamarin/urho] Dependency injection for Application (#401) The Urho.Extensions.WinForms.UrhoSurface uses Activator.CreateInstance to produce the application instance in Show. This means that one cannot inject any dependencies and has to resort to some static service locator.It would be cool if there was a Show overload that took a Func<ApplicationOptions, Application> to produce the application instance which could be made to redirect to the dependency injection container in use.—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.
4 The Quadrangle, Grove Business Park Downsview Road, Wantage, Oxfordshire, United Kingdom, OX12 9FA+44 (0)1235 227 360www.airboxsystems.cominfo.airboxsystems.comTHIS E-MAIL IS DESIGNATED AS PROTECTED AND IS FOR YOUR EYES ONLY.
|
This works, actually, but the code looks rather ugly. I've made the derived options type that gets all the dependencies a nested class in my urho application, and the attached property that calls |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The
Urho.Extensions.WinForms.UrhoSurface
usesActivator.CreateInstance
to produce the application instance inShow
. This means that one cannot inject any dependencies and has to resort to some static service locator.It would be cool if there was a
Show
overload that took aFunc<ApplicationOptions, Application>
to produce the application instance which could be made to redirect to the dependency injection container in use.The text was updated successfully, but these errors were encountered: