We have an existing REST API built with ASP.NET Core (2.1), EntityFramework Core (2.1) with tens of Controllers that basically provides CRUD on tens of SQL tables. Very simple yet.
Each Controller has a method that fetch data from SQL table (through DbContext), retrieved models are mapped into 'DTO' and returned as ActionResult.
We receive lot of feedback to implement simple way to query API, like the OData way.
Is it possible to integrate OData to existing controllers, respecting existing routes, on existing DbContext?
Ideally, I would do some configuration and then just add [Queryable] on method to which I want to provide OData query.
Every example I have found contains such code:
routes.MapODataServiceRoute("odata", "odata", builder.GetEdmModel());
Related
I have an application which is in ASP.NET, ADO.NET, Oracle 11g
My structure of application is as follow
There are business entity classes for every entity in my application
Employee entity contains
a. Name
b. Age
etc
I have written a stored procedure to fetch and insert every operation related to database using ADO.NET. It return list<> of Business Entities from by separate logic part.
Some of the presentation logic is split into user-controls.
Using jquery-ajax to load most of the component for asynchronous load on pages. To speed up the page.
Have used data-caching in my project.
Not wanted to move the project into MVC 4 for better performance. Is it a good idea to move the project to ASP.NET MVC?
I also wanted to know weather it is technically ok to change it to mvc.
I don't want to change my database logic as it is well written.
So can I use MVC?
Any suggestion on any link provided will be a good help.
I have an O-Data service, and I already consumed it in ASP.Net project using VS 2012
Now i want to use an ASP.Net User Control to handle CRUD operations for this odata service automatically.
I hope to find a user control like GridView that allow me to :
Display the data from the odata service.
Add new records.
Update an existing one.
Delete an existing one.
You have a few options, but Kendo UI/Telerik's MVC Grid probably the most prevalent that has built in support:
http://blogs.telerik.com/aspnetmvcteam/posts/10-12-16/binding-telerik-grid-for-asp-net-mvc-to-odata.aspx
http://www.telerik.com/products/aspnet-mvc.aspx
Personally, I would recommend to do your own CRUD operations, or use something like Datatables http://www.datatables.net/ and write your own adapter to run between.
I am trying to learn MVC. I want to automatically generate the required view code as and when I add a controller. This is possible if I select the option “Controller with read/write actions and views, using Entity Framework” . However I am not using Entity Framework. How can I achieve the similar behavior without using Entity Framework? And why it is unable to automatically generate the view when I don’t use Entity Framework?
Also, is there any good MVC3 tutorial that does not use Entity Framework (with code download available) ?
Reference
How do I configure ASP.net MVC to Scaffold using ADO.net dataservice?
Levergaing T4Scaffolding for WCF Web API
ASP.NET MVC 3 and NHibernate Scaffolding
Scaffold your ASP.NET MVC 3 project with the MvcScaffolding package
Once again LINQ to SQL or Entity Framework for new MVC 3 project
MVC Scaffolding for WCF Services
Create a Dropdown List for MVC3 using Entity Framework (.edmx Model) & Razor Views && Insert A Database Record to Multiple Tables
You might find some of what you're looking for in Steve Sanderson's MvcScaffolding package
Nuget
Install-Package MvcScaffolding
After installing (it will probably install some EF requirements) you could scaffold basic CRUD views for your model as follows assuming a model type MySweetModel
Scaffold Views MySweetModel
Please note this command will not create the controller class, but should create the following views under /Views/MySweetModel
_CreateOrEdit.cshtml
Create.cshtml
Delete.cshtml
Details.cshtml
Edit.cshtml
Index.cshtml
It looks like you might be able to override the default T4 templates, but I've never used MvcScaffolding outside the scope of EF. It's also possible someone has already done this for your persistence layer e.g. NHibernate or whatever you're using. I'd search a bit before implementing your own templates.
I'm using ASP.NET Web Forms and can't migrate to ASP.NET MVC right now. I love the way the MVC team implemented a custom IHttpHandler, or HttpModule (Not sure which one) that gets the JSON data passed in from an Client Side Ajax request and passes the data into the action method on the requested page.
I want to be able to intercept a Http Request, retrieve that JSON/"Query String Parameters", and call a method on the page while passing the retrieved data as it's parameter.
Currently, i've implemented a custom route and it works fine. The only part that is missing for me is the "Custom Model Binder" as the call it in ASP.NET MVC.
Please can someone help me with a clue as to how i can go about it.
Have you considered ASP.NET MVVM?
ASP.NET MVVM provides a framework to implement the Model-View-ViewModel pattern, a.k.a. the Presentation Model pattern in ASP.NET projects. Developers can take advantages of Dependency Injection and Event Broker to write concise, elegant and business focused code.
The ASP.NET MVVM offers the following benefits:
Leverage ASP.NET functions, such as web form, user control and data
binding
Achieve a clear separation of concerns
Facilitate test driven development (TDD)
Write and maintain simpler code using the attribute annotations
I have a legacy ASP.Net web application that is basically used to process web services.
I am adding some new functionality and would like to start using EF4.1. I'm fairly new to EF, and I'm not quite sure the correct path to take here.
The client using this web service is a Linux based client running Apache, so data will be passed back and forth using SOAP.
My question is, what is the best practice for getting EF models into and out of a SOAP data class? Would using EF POCO classes be the best for this?
You could use the Entity Framework for data access with either a ASMX or WCF web service that will use SOAP.
Using Entities with Web show give you some direction and ideas.