structuremap - "Applying Setter Injection to an Existing Object " Can I do this? -


दो मौजूदा ऑब्जेक्ट SetAllProperties () क्या मुझे इसका उपयोग करना चाहिए?

  var theGateway1 = new DefaultGateway (); Var कुछ = नया कुछ (); ObjectFactory.Initialize (x = & gt; {x.ForRequestedType & lt; IGateway & gt; ()। TheDefault.IsThis (द गेटवे); x.ForRequestedType & lt; ISomething & gt; () .Default.IsThis (कुछ); // पहले हम एक नया सेटर इंजेक्शन बनाते हैं नीति है कि / / बलों StructureMap सभी सार्वजनिक गुणों को इंजेक्ट करने के लिए / जहां संपत्ति प्रकार IGateway x.SetAllProperties (y = & gt; {y.OfType & lt; IGateway & gt; (); y.OfType & lt; ISomthing & gt; ();})}}) ; यदि आप वास्तव में इन दो उदाहरणों के साथ सभी सेटर्स को इंजेक्ट करना चाहते हैं, तो यह ठीक है। बस नया सिंटैक्स का प्रयोग करें:  
  ObjectFactory.Initialize (x = & gt; {x.for & lt; आईगेटवे & gt; ()। उपयोग (द गेटवे); एक्स। & Lt; आईएसमाइटी & gt; ()। कुछ); x.SetAllProperties (y = & gt; {y.OfType & lt; IGateway & gt; (); y.OfType & lt; ISomething & gt; ();});});    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -