Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Instantiate class from custom assembly/DLL
Message
De
25/03/2015 11:00:47
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 5.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01617218
Message ID:
01617259
Vues:
32
>>Thanks for the info. IoC/DI adds a little more complexity than I'd like, but I'm still learning. I just found this book on Unity, and I'm finding it a good resource: http://unity.codeplex.com/documentation
>>
>
>Yeah, an IoC container will do what you want. You specify the interface and it gives you the concrete implementation based on how it's configured (plus injects any dependencies into the class). Unity is pretty complex - I'd pick something simpler - Ninject, or Autofac, or even StructureMap.
>
>Viv's suggestion also works well. I actually do something like that for a lot of my projects where I mostly want a central place to configure my objects and don't want the additional complexity of an IoC and don't want to introduce interfaces everywhere. If you want to swap them out, you'd still need to use interfaces.

Thanks, I'll check out those other containers. As far as I can tell, I can instantiate a subclass in place of a parent class without an interface, as long as the reference is typed to the parent class. Am I wrong about that? Or do you mean that IoC containers require interfaces to swap anything?
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform