Skip to content

Instantly share code, notes, and snippets.

@redwards510
redwards510 / ASPDotNetRazorCheatsheet.md
Created February 20, 2018 23:52
ASP.Net Razor Cheatsheet
tags
Cheatsheet
Razor

Razor Cheatsheet

Inside code blocks

@redwards510
redwards510 / irssi.md
Last active August 14, 2023 23:15 — forked from tasdikrahman/irssi.md
irssi cheatsheet
@redwards510
redwards510 / DgmlController.cs
Last active March 11, 2022 15:25
Uses EF Core Power Tools by ErikEJ (see link in code) to creates a .DGML class diagram (and serves it up for saving) of most of the EntityFrameworkCore (EF Core 2) entities in the ASP.Net MVC project when you go to yourwebsite/dgml. This is useful because there is no Class Diagram support in .Net Core 2 yet and it is difficult to find any kind o…
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace CHANGEME.Api.Controllers
@redwards510
redwards510 / ApiControllerWithContext.cshtml
Last active October 12, 2017 17:19
Asp.Net Core 2.0 Async WebApi Template with EF Core 2.0 Entities for Scaffolding EF Core web api controllers with a lot more Swagger-friendly ResponseType attributes. Includes instructions to do custom scaffold.
// This began life as the default Microsoft template you get when you scaffold an Entity Framework .Net core 2.0 Api Controller.
// What I've done is add more Swagger-friendly API documentation, calls to a repository, mapping using Mapster.
// It produces nearly complete Api methods.
// Problems: The PUT method has no documentation
// ProTip: If your formatting gets completely hosed when you paste code into the template file, try hitting ctrl+z. It will reformat back the way you had it.
// File goes in Templates\ControllerGenerator\ApiControllerWithContext.cshtml in the root of your project. Then
@inherits Microsoft.VisualStudio.Web.CodeGeneration.Templating.RazorTemplateBase
using System;
using System.Collections.Generic;