Breeze.js with Katana middleware - breeze

I have not had the opportunity to test more I wonder if it is possible to be all right migrate to the full asp.net WebApi to Katana middleware.
There are some sample project or references?
I did not notice something in breeze.js.samples repository.

Related

Is it possible to remove all .Net MVC components in a .Net Web Api application so that I can use AngularJS as the front end?

I'm creating an application with a .Net Web Api project wanting to use pure AngularJS as the client side. Since Web Api is built on top of MVC, it creates MVC specific and default items that I feel is not needed. These items include the HomeController, _ViewStart.cshtml, _layout.cshtml, etc. I tried removing them but it comes up with errors. Has anyone tried to remove the MVC stuff out of the web api project and used separate client side front-end? Is it even possible to remove the MVC items without errors?
Remove RouteConfig.cs from App_Start, remove the Views directory and all sub-directories including the Views internal web.config file. Comment out or delete all the lines in the Global.asax.cs Application_Start method except GlobalConfiguration.Configure(WebApiConfig.Register). Remove the HomeController, add an index.html and any needed Angular scripts and go at it. I also added solution folders to organize my views as reusing the existing Views folders did not work. I'm using VS 2015 but is should work for 2013 also. PWE
Web API is not built on top of MVC.
The default templates bring in MVC for the sake of supporting a help page, but you don't need to use it.
You can start with an empty web project and just check Web API.
The routing piece is server routing and it's part of what maps the URL to Controllers+Actions, it has nothing to do with Angular routing.
As Mike Cheel alluded to, there are no dependencies between MVC and Web API. However, if you use the built-in templates, it's easy to get the impression that the 2 are linked. They include a lot of stuff in these templates because they can't anticipate where you want to go with your project... so they try to cover all the bases.
For your purposes, you would probably be better off to start with an empty project and add only the components that you actually need. For this approach, some of the best tutorials and starter projects are from Taiseer Joudeh's "Bit of Technology" blog. His tutorials helped me to build an "MVC Free" web application from scratch that uses JSON Web Tokens and AngularJS Interceptors for security and Web API 2 and Entity Framework to serve up the data.
He has many tutorials on his website... but you might want to start with "AngularJS Token Authentication using ASP.NET Web API 2, Owin, and Identity". What what.. you didn't ask about security? Well... security is an issue that you will need to confront at some point anyway... and Taiseer presents a nice solution for securing an Angular/Web API application.

Why MVC in Durandal VS project template?

All the action is client side in a SPA app. The Visual Studio Durandal and Hot Towel project templates both serve the SPA out of an ASP.NET MVC application.
What, if anything, does the ASP.NET MVC infrastructure bring to the party? As far I can see all it does is make it hard to serve a WCF Web Service (ajax enabled) out of the project web.
Yet both of the project templates are set up like this. What have I missed?
As a matter of fact, ASP.NET MVC in this template is not necessary. All it does is serve the initial Razor template for the SPA and provides you with the bundling and optimization support of all the client side javascript resources for the application so that when you deploy your application you don't end up with gazillions of HTTP requests from the client to fetch all the .js crap necessary for the application to work. Of course you could perfectly fine have used the bundling feature outside of ASP.NET MVC in a simple and plain ASP.NET web application.
What, if anything, does the ASP.NET MVC infrastructure bring to the party?
See the documentation:
Hot Towel builds on the familiar and powerful ASP.NET MVC structure.
App_Start
Content
Controllers
Models
Scripts
Views
As far I can see all it does is make it hard to serve a WCF Web Service (ajax enabled) out of the project
You can't just right-click your project and add a new WCF Service?

IdentityConfig is missing in MVC 5

I am migrating my project to MVC 5 and I've just installed Visual Studio 2013 RC. As far as I can see there must be a file named IdentityConfig.cs in the App_Start directory, but even if I create a new project, that file is missing. I am thinking that maybe it could be about version of Visual Studio that I am using. Is there anyway to solve this problem?
Also, I can't add Roles or Membership Providers to web.config. How can I do this with IdentityConfig?
IdentityConfig.cs is no longer required and was removed in the RC version. This is discussed in the article "Introducing ASP.NET Identity". Here is the relevant snippet from this article.
Following are the notable changes from 1.0.0-alpha1 – 1.0.0-beta1
In these templates you no longer need IdentityConfig.cs
Lots of public APIs were changed for renames and refactoring of code.
Transactions support was added to the framework.
What you should find in App_Start is a Startup.Auth.cs file configuring the authentication / authorization middleware for the site.
ASP.NET MVC 5 doesn't use the role providers and membership providers that have been around since ASP.NET 2.0. You could still configure those into a web site, but then you'd probably want to get rid of the middleware.
By middleware, I mean most of the authz features are moving into OWIN middleware for ASP.NET. The StartupAuth.cs file and the AccountController in a new MVC 5 project show you a bit how everything can work together, although it is not well documented.

Difference between WebApiConfig.cs and RouteConfig.cs

What is the difference between WebApiConfig.cs and RouteConfig.cs in the App_Start folder of an MVC Web API project in Visual Studio 2012?
The following are the key differences:
RouteConfig.cs is exclusively for configuring ASP.NET routes.
WebApiConfig.cs is for any Web API related configuration, including Web-API-specific routes, Web API services, and other Web API settings.
As cmotley mentions, the ASP.NET web site includes a good listing of what types of configuration can be done in WebApiConfig.cs in this article.
There is no difference as they both accomplish the same thing - adding routes to your route collection. You don't need to use the WebApiConfig class; it's simply a convenient way to organize your code.
If you are familiar with ASP.NET MVC, Web API routing is very similar to MVC routing. The main difference is that Web API uses the HTTP method, not the URI path, to select the action. You can also use MVC-style routing in Web API. This article does not assume any knowledge of ASP.NET MVC.
From Routing in ASP.NET Web API

Custom Authorization/Authentication with Repository pattern

All greetings
Anyone can do their implementation Authorization system?
Do not use the Membership API?
Of course we could implement custom providers to plug a different database into this framework, as detailed at MSDN, but if my application is going to use a repository pattern for data access, and I’m going to have specific controllers and views for creating/editing users, why should membership and authorization be routed through this other framework?
If yes:
I'm just interested in how not to make holes in security.
Use FormsAuthenticationTicket?
How about IPrincipal?
Maybe you have some example or project on codeplex.com on other Authorization/Authentication
I use Kristoffer Ahl's excellent FluentSecurity library to manage authorization in a centralized place in my ASP.NET MVC applications. The thing I like most about it is that it keeps me from forgetting to secure controllers because it throws an Exception when a Controller is accessed for which there is no security policy specified.
Resources:
Project Website: www.fluentsecurity.net
NuGet Package: install-package FluentSecurity (see NuGet Gallery)
Source Code: GitHub » kristofferahl » FluentSecurity

Resources