I am trying to see if the controller class name is the name of the controller name passed in. I think my lambda expression is wrong and that is why it isn’t working properly. I am passing in the correct controller names, but the export variable is always null.
Public Function CreateController(requestContext As System.Web.Routing.RequestContext,
controllerName As String)
As System.Web.Mvc.IController Implements
System.Web.Mvc.IControllerFactory.CreateController
Dim controller As IController = Nothing
If controllerName IsNot Nothing Then
Dim controllerClassName As String = controllerName & "Controller"
Dim export As Lazy(Of IController) = Me.container.GetExports(Of IController)().Where(
Function(c)
Return c.Value.GetType.Name = controllerClassName
End Function
).FirstOrDefault()
If you need me to clarify anything, please let me know! Thanks!
yes your lambda expression is wrong, this should do the trick