public DestinationEndPoint(XmlNode defn, NLog.Logger logger) { this.logger = logger; string protocol = defn.Attributes["protocol"].Value; endPointDestination = new DestinationFactory().GetSender(protocol); OK_TO_RUN = endPointDestination.Configure(defn, this, logger); }
public DestinationAbstract GetSender(string senderName) { string senderClassName = GetSenderClassName(senderName); var type = typeof(DestinationAbstract); IEnumerable <Type> types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => type.IsAssignableFrom(p)); foreach (Type t in types) { if (!t.IsAbstract && !t.IsInterface) { if (t.Name == senderClassName) { DestinationAbstract dest = (DestinationAbstract)Activator.CreateInstance(t); return(dest); } } } return(null); }