ASP.NET Core Web Api automatic help pages - asp.net

In previous versions of ASP.NET, when I created Web Api 2, visual studio automatically wired up automatic generation of documentation for the API.
It's also explained here:
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages
I'm writing a new project and I've decided to do it with ASP.NET Core, but I don't see anything similar to what existed in the previous versions that generates the documentation from the API (I'm also guessing that's its a bit different since all controllers now inherit from the same Controller class).
But, is there some way to have help files generated for ASP.NET Core APIs?

The functionality you want is at https://github.com/domaindrivendev/Swashbuckle
The following link provides an example of how to configure and use the well-designed utility
https://damienbod.com/2015/12/13/asp-net-5-mvc-6-api-documentation-using-swagger/

John Davidson made a good post showing how to generate Swagger documentation - that is useful and great.
But if you want to stick to ASP.Net MVC 5 - Api Explorer documentation, you should have a look to that excellent blog post :
https://andrewlock.net/introduction-to-the-apiexplorer-in-asp-net-core/

Related

Embed Alfresco WebPreviewer in my own website

I have a Spring MVC application that connect with Alfresco using CMIS libraries, actually I can upload documents and download it but I need integrate Alfresco's WebPreviewer to preview documents in my app.
I found some code here but I don't know how to do it
It's hard to say for certain because of the limited amount of information that you've provided, but I think that the problem that you're going to be faced with when trying to use any of the existing previewer code is one of authentication. If you're using only using CMIS then you won't be able to use any of the WebScript based REST APIs that the Alfresco widgets will be using.
There are two possible previewer widgets that you can use - the older YUI2 based previewer (that you'd currently find in the document details page and the Document Library film strip view, and the newer Aikau component that you'd find in the faceted search previewer (from version 5.0 onwards).
I suspect that you won't be able to re-use either of these components without either authenticating against Alfresco in a way that allows you to access the WebScript based REST APIs or extending and customizing those widgets.
You've said that you have your own Spring MVC application, but you haven't said whether or not that is using the Surf extension - if it is, and you're using the authentication capabilities provided by Surf then you will be authenticated to use those REST APIs - as the Surf authentication provides access across all APIs (including CMIS) via a single authentication.
If you are able to access those APIs then you should be able to follow the steps outlined in both the form post and the blog posts in your own question and the previous answer, however - based on your question I suspect that you can't do that.
If you've not come across it, you might be interested in the Aikau archetype that builds a ready-made Alfresco client using Surf (see this link) and that tutorial also shows how to use the Aikau previewer (see here).
Because this is providing you with a Spring MVC client that is preconfigured to authenticate against Alfresco, you might be able to port your application to use it.
Otherwise, as I said earlier - chances are you'll need to extend the existing widgets to use the CMIS APIs to render the previewers. Again, Aikau is easier to extend that the old YUI2 widgets - but is reliant on Surf.

MVC6 Load razor views from database

We are working on ASP.NET MVC 6 project and it's necessary to load and then compile Razor views from an external source (Azure document database).
I see in other SO posts (<= MVC 5) it was possible to create and register a custom VirtualPathProvider which can take view content from DB or resource DLLs (for example).
What are the options for MVC 6 ?
Technically not implemented yet. This is after all a rewrite and not just a set of new features.
I found a thread on GitHub which talk about a way to get what you need.
Basically, it's about providing your own implementation of IFileProvider.
I have virtually no experience in implementing this but I think that if you have time to spare, this is definitely the way to go.
A bit late to the party, but if you are still looking at this I have just posted a sample project to GitHub showing how to store your .cshtml in Azure Blob storage using ASP.NET 5 / MVC 6.
#Maxime Rouiller - MVP is correct that you need to provide a custom IFileProvider. My sample is using rc1-final and working. Looking at the aspnet project though, this may change subtly later (will allow multiple providers to be registered)
A blog post write up on this should be coming in the next few days too.

Single Page Application Project Templates for.NET 4.5 and Angular

Has there ever been a more confusing/difficult time to be a web developer using the Microsoft stack? That's not really my question... I know that the answer is a categorical no. :)
The single page app template that comes with VS 2013 is deplorable.
I've been working on building up a similar project template that uses Angular JS on the client, but I'm starting to spin my wheels a bit porting over the external (openId/oauth) login features.
I believe this is because of the lack of good, single-point-of-truth, and current documentation for Katana's auth/security bits and also because of how unreadable the client side code is in the S.P.A. template in visual studio 2013.
I know that I can get through it, but while I'm struggling with it, I'm wondering:
Are there any good community provided project templates or example code bases in existence that use .NET 4.5 (MVC5/Web Api 2), Angular JS, the new ASP.NET Identity stuff, and the Katana packages?
There's HotTowel.Angular, but it takes no stance on security. Besides, it's a Nuget package, which can't or shouldn't dictate as much as a proper project template can.
I agree with your observations. I have found the following setup that seems to meet your requirements and I think works very well (I don't have a template), I would suggest the following:
Create an empty WebApi2 project and adopt authentication/authorization depicted here
Use a regular index.html in the base directory as a launching point for your angular application. You can either maintain your client packages with nuget, npm, or bower.
Use whatever technique you like for organization of client code.
Personally, I would create 3 projects, One for client code, (mydomain.com) One for your api (api.mydomain.com) and one for your Model/Repository/Data Access layer.
update
Here is an open-source project that might be what you're looking for!

developing with ASP.NET using framewok

I have been working for 4 years as a PHP developer and I'm currently transferring to ASP.NET (Since I have 4 years of C# experience too, and selected PHP because of specific conditions - now I wish to use my C# knowledge and the .NET Framework is impressive).
When developing with PHP, I always use a framework - or something I've wrote myself (I'm working as a software architect...) or Zend Framework / Yii etc - the reasons is lack of classes, tools and OOP in PHP (such as MVC, ACL, Cache etc.)
When working with ASP.NET MVC 3, I see that combining the MVC framework and the general .NET framework I have many tools, and here is my point: when developing in ASP.NET, do you need to use any other framework than .NET? (just like in PHP I'm using Zend).
If so, there's any recommended frameworks?
Thanks! :)
In a .Net world, there are many options infront of you. see below popular vendors;
www.devexpress.com
www.telerik.com
www.comonentone.com
www.infragistics.com
But most of the time, asp.net is perfect itself. And when you are talking about mvc3. You can use another view engine instead of using Razor(the default one) such as spark. So, i mean that asp.net itself can be expended accroding to your needs.
And when you are working with mvc3, then you have best choice which entity framework. There is alot of support out there for this framework. So good luck in this.
Yes, there are other frameworks that you can choose to use alongside .NET MVC - but I myself haven't chosen to utilize them in any recent projects. Here are a few examples aside from what others have already pointed out:
http://www.springframework.net/
http://sparkviewengine.com/
That said, while I don't personally use frameworks like I mentioned above here in no particular order are a few tools that I have found that I have come to rely on while developing applications within ASP.net MVC:
Fluent Nhibernate - If you choose to use Nhibernate as your ORM
Ninject - Dependency Injector
AutoMapper - object - object mapper
ELMAH - error logging facility
lg4net - logging etc
Check out Telerik http://www.telerik.com/ They have some great tools like their RadGrids and specific imput textboxes that once you get used to will save a ton of time and add a lot more flexibility. Definitely worth a look.
No THE framework has everything you normally need. But the amount of tooling available is tremendous! We use asp.net 4.0 but we choose DevExpress controlls to get nice look and feel and functionality that would cost too much to build myself.
We worked with almost every component builder in the last 10 years but DevExpress is our favorite for one simple reason. Super fast support! And I agree with the above comment about Infragistics very disapointing support!
But again those vendors or other community frameworks are there too make our life even simpler. By itself THE framework can solve almost everything from THE core libraries.
Good luck switching to C# again my favorite language too!

Issues with Asp.net administration tool

i have created a project in asp.net.now i want to implement asp.net administration tool in my project for user management.The tool works fine in a website ,but in a project it does not work.
Actually i have used the follows links to do this:-
http://msdn.microsoft.com/en-us/library/bb515342.aspx
When i implemented this walkthrough in the project, the Profile.aspx.vb shows errors.Means in this walkthrough it is specified that profilecommon will be formed dynamically.In website its working.But in project its shows 'ProfileCommon is not defined. What may me the reason?
It sounds like you want to implement your own version of the ASP.NET Web Site Administration Tool (WSAT) for use "inside of" your own website.
The walk-through that you link to is okay, however, it doesn't walk through creating anything that is particularly generic and can be simply "dropped in" to an existing web site.
I'd suggest looking at this tutorial:
Rolling Your Own Website Administration Tool
as a way of creating your own set of pages specifically for user/role/membership management. You can even download the code for the article if you don't want to re-type it all out yourself. Unfortunately, the code for this tool and in this article is in C#, however, the code is not especially complex and should be able to be easily converted to VB.NET using one of the many available code converter tools.
There is also this tutorial:
Users and Roles On The Production Website
which is VB-specific and should help with building your own WSAT-like tool.
Some time ago, on the CodePlex site, there was an ASP.NET WSAT Starter Kit project that also served the same purpose (and arguably improved on the "default" WSAT considerably), however, that project unfortunately no longer exists. After some searching however, it appears as though the code for this tool is still available, so you could perhaps take a look at that tool also (the code is in VB).
You can find that here:
ASP.Net WSAT (Web Site Administration) Starter Kit. What happened?
(check the very last post at the bottom of the page).

Resources