Skip to content

Latest commit

 

History

History
84 lines (76 loc) · 1.36 KB

TOLEARN.md

File metadata and controls

84 lines (76 loc) · 1.36 KB

Things That I Still Totally Do Not Understand in ASP.NET Core

Program.cs

builder.Services.AddScoped<T, U>();
builder.Services.AddScoped(factory);
builder.Services.AddDistributedMemoryCache();
builder.Services.AddSingleton<T, U>();
builder.Services.AddSession();
app.UseSession();

Database & Stuff

private readonly StoreDBContext context;
public IQueryable<T> QueryableCollection => context.Collection;

Controllers

public ViewResult Route<T>(params T[] args) {}
public IActionResult Route<T>(params T[] args) {}
ViewBag.DynamicProperty = SomeValue;

ASP Attributes

<input asp-for="Property" />
<div asp-validation-summary="All" />
<form asp-action="Action" />
<a asp-controller="Controller" />

Unit Testing

using Moq;
using XUnit;
[Fact]
public void CanPassTest() {}

View Components

public IViewComponentResult Invoke() {}

LINQ Extension Methods

context.AttachRange(collection);
collection1
    .Include(collection => collection2)
    .ThenInclude(collection => collection3);

Razor Pages

@page PageName
@model ModelName
@functions {
    [BindProperty(SupportsGet = true)]
    public T? Property { get; set; }
}