This is a migrated thread and some comments may be shown as answers.

[Solved] Unsupported Context Type

1 Answer 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bill
Top achievements
Rank 2
Bill asked on 01 May 2011, 12:16 AM

I am getting the above error when trying to add a Controller in my client project. I have the Open Source MVC 3 controls installed. I am using version 2011.1.315.  I have attached files displaying the error.

I have a web service in another project that I'm accessing. This project contains a v4.1 ADO.Net Entity Data Model. Very simple. Six tables in the database. I have already run the web service project and it recognizes the database and customers come up via an OData command in the browser (see below code):

<code>

namespace YeagerTechService
{
public class YeagerTech : DataService<YeagerTechEntities>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("Customers", EntitySetRights.All);
//config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
}
}

</code>

My client project accesses the web service through a service reference. I am able to put the namespace in my HomeController class (see below code).

<code>

using YeagerTech.YeagerTechService;

</code>

When trying to add a new controller, I just want to display the customers from the Entity Model with a detail view via a Telerik extension (see below code):

Here are the parameters when trying to add the Controller:

ControllerName: CustomerController

Scaffolding Options:

Template: Controller with read/write actions and views, using Entity Framework

Model Class: YeagerTechEntities(YeagerTech.YeagerTechService)

Data Context Class: GridDetailViewItem (Telerik.Web.Mvc.HI.Html)

Views: Razor (CSHTML)

After clicking "Add", that's when i come up with the same exact error...

What is the resolution to this issue?

1 Answer, 1 is accepted

Sort by
0
Bill
Top achievements
Rank 2
answered on 21 Jul 2011, 06:05 PM

I found what the issue is...

I have a 3 tiered architiecture I'm using with each of the below projects in one solution.

  1. YeagerTech
  2. YeagerTechWcfService
  3. YeagerTechModel

No matter what, even though my wcf service references my model, the startup project (1) is not "smart" enough to recognize the metadata to create the Controller. In this case, you must include a reference to your project that includes your edmx model.

You must also ensure that the connectionstring also resides in the startup project (1) via the web.config file, in order to get the connection for the metadata.

Tags
Grid
Asked by
Bill
Top achievements
Rank 2
Answers by
Bill
Top achievements
Rank 2
Share this question
or