ODataController를 런타임시 별도의 클래스 라이브러리에로드/삽입하고 해당 서비스를 라우트하고 싶은 VS2013 아래에 OData V3 C# 프로젝트가 있습니다. 문제는 컨트롤러로 해석 할 경로를 얻을 수 없다는 것입니다. 예 :런타임에 OData V3 컨트롤러 추가 - 컨트롤러를 찾을 수 없습니다.
public static void Register(HttpConfiguration config)
{
var builder = new ODataConventionModelBuilder();
<lots of 'local' builder.EntitySet<***>("***") calls>
builder.EntitySet<Test>("Tests");
var assembly = Assembly.LoadFrom("<full path to classlib.dll>");
// test that we can find and load an instance
var type = assembly.GetType("WebApi.Extensions.TestsController");
var obj = Activator.CreateInstance(type);
// no errors so far. I can 'see' into 'obj'
config.Routes.MapODataRoute("odata", "odata", builder.GetEdmModel());
}
사람이 이유를 볼 수 :이이
namespace WebApi.Extensions
{
public class TestsController : ODataController
{
var t = "some string";
public IHttpActionResult Get(ODataQueryOptions<Test> queryOptions)
{
...
}
}
}
그리고 내 WebApi 등록() 메소드 : http://localhost/odata/Tests
"No type was found that matches the controller named 'TestsController'"
여기 내 컨트롤러는 별도의 클래스 라이브러리에서의 모습입니다 컨트롤러 클래스로 해결할 경로를 얻을 수 없습니까? 나는 그것을 함께 묶는 것을 놓치고 있습니까?