Skip to content

Instantly share code, notes, and snippets.

Derek Comartin dcomartin

View GitHub Profile
View dbContext.cs
protected override void OnModelCreating(ModelBuilder modelBuilder)
.Property(v => v.BlogName).HasColumnName("Name");
View model.cs
public class BlogPostsCount
public string BlogName { get; set; }
public int PostCount { get; set; }
View view.cs
@"CREATE VIEW View_BlogPostCounts AS
SELECT b.Name, Count(p.PostId) as PostCount
FROM Blogs b
JOIN Posts p on p.BlogId = b.BlogId
GROUP BY b.Name");
View ShipmentReadWrite.cs
public class ShipmentCommand
private DateTime? _delivery;
private string _proofOfDelivery;
public ShipmentCommand(Guid shipmentID)
// Load current state
View Shipment.cs
public class Shipment
private DateTime? _delivery;
private string _proofOfDelivery;
public Shipment(Guid shipmentID)
// Load current state
View startup.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
View app.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<Folder Include="wwwroot\" />
View redisname.cs
services.AddSignalR().AddRedis(options =>
options.Configuration.ClientName = "SignalR";
View redis.cs
// For Microsoft.AspNetCore.SignalR.Redis
// For Microsoft.AspNetCore.SignalR.StackExchangeRedis
View startup.cs
public void ConfigureServices(IServiceCollection services)
.AddJwtBearer(options => {
options.Events = new JwtBearerEvents
OnMessageReceived = context =>
var accessToken = context.Request.Query["access_token"];
if (string.IsNullOrEmpty(accessToken) == false) {
You can’t perform that action at this time.