I have a base class which implements the IRouteConstraint
interface. I'm trying to extend that class and override the Match()
method defined in the base class. This is for an ASP.NET MVC5 application using Visual Studio 2013 Update 2.
My classes are structured like this:
\Project\App_Code\BaseRouteConstraint.cs:
namespace Website {
public class BaseRouteConstraint: IRouteConstraint {
public virtual bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
...code
}
}
}
\Project\App_Code\DerivedRouteConstraint.cs:
namespace Website {
public class DerivedRouteConstraint: BaseRouteConstraint {
public override bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
if(!base.Match(httpContext, route, values, routeDirection) {
...code
}
}
}
}
But I can't actually use the DerivedRouteConstraint class because Visual Studio says it doesn't exist. I also get this warning:
'Website.BaseRouteConstraint' in 'C:\Project\App_Code\BaseRouteConstraint.cs' conflicts with the imported type 'Website.BaseRouteConstraint' in 'C:\Project\'. Using the type defined in 'C:\Project\App_Code\BaseRouteConstraint.cs'
I've checked and I haven't accidentally copied the source code file for my base class anywhere else in the solution.