I am getting the above error when trying to add a Controller in my client MVC 3 project.
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?
10 Answers, 1 is accepted
If you need me to submit more info, just let me know....
This is not supported. Just specifying GridDetailViewItem in the MVC dialog will not generate a grid page for you. The MVCScaffolding has no notion of Telerik Extensions for ASP.NET MVC.
All the best,Atanas Korchev
the Telerik team
However, how do you then generate a Telerik grid from a controller based on an entity coming from the database? I assumed Telerik would have implanted these extensions into the MVC 3 scaffolding. Is it all manual coding? No scaffolding options at all?
Please let me know if Telerik plans to implement this in the future.
What are we supposed to do now based on this scenario? How do we generated the code for the View? If it is manual, could you supply a short code snippet for an example? If not, what do we supply as an option as far as what to pick from the drop down list for the scaffolding? Why would the Telerik extensions be in the list if they cannot support the scaffolding?
Thanks a head of time for you answers to these questions....
To back up that I think I'm putting in the correct info, here are some code snippets:
Inside my WCF Data Service where the EDMX model is:
<code>
namespace YeagerTechService
{
#region Contexts
/// <summary>
/// No Metadata Documentation available.
/// </summary>
public partial class YeagerTechEntities : ObjectContext
{
</code>
<code>[EdmEntityTypeAttribute(NamespaceName="YeagerTechModel", Name="Customer")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class Customer : EntityObject
</code>
I'm just trying to add a new Customer Controller with the "Add New" for the Controllers folder.
What am I doing wrong where the Controller can't get created with the CRUD operations from the wizard. I'm stuck at this point and would appreciate any help.
If you need any more info, I'd be happy to supply it to you.
If you could also answer my previous quetions, that would be great as well.
Thanks so much, bill...
I would like again to mention that the MVC scaffolding does not work with Telerik Extensions for ASP.NET MVC. You need to declare the grid in code. A good starting point is our online documentation as well as the online demos.
Regards,Atanas Korchev
the Telerik team
However, how does the "Add Controller" wizard know that I want to add a Telerik grid instead of standard MVC CRUD operations? If I want to add a standard form (instead of Telerik) and I pick the same values in the wizard, I need the wizard to be able to create CRUD operations in the new controller.
How can I achieve this?
I don't understand the question. Do you mean that the Add Controller wizard automatically picks the grid classes?
Regards,Atanas Korchev
the Telerik team
I was able to do this (Add a Controller), with no problem at all. I don't know if it's because I'm using the Entity Framework in the wizard or not. Before, when I just had my own classes, adding a controller was no issue.
I don't know whether it's because of the Telerik MVC controls installed and or using the Entity Framework in the wizard.
Could you please clarify this for me?
Basically the Telerik MVC VSExtensions don't interfere with the Add New Controller item template at all. I was not able to reproduce the problem on my side, but I guess I'm missing lots of stuff on my project compared to yours.
The easiest approach to verify if the Telerik MVC VSExtensions cause the problem is to disable them using the Tools -> Extension Manager (VS restart is required after the disabling). Can you check that for me please?
Erjan Gavalji
the Telerik team
I found what the issue is...
I have a 3 tiered architiecture I'm using with each of the below projects in one solution.
- YeagerTech
- YeagerTechWcfService
- 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.