View blog_example_aspnet_core_2_startup_configure.cs
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseStaticFiles();
app.UseAuthentication();
app.UseMvc();
}
View blog_auth_successful_user_null.txt
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
Authorization was successful for user: (null).
View idisposable_teardown_xunit.cs
public class TruthTests : IDisposable
{
public TruthTests()
{
}
public void Dispose()
{
//Do cleanup actions here
//
View running_aspnetcore_server_port_at_command_line
# Unix:
ASPNETCORE_URLS="https://*:5123" dotnet run
# Windows PowerShell:
$env:ASPNETCORE_URLS="https://*:5123" ; dotnet run
# Windows CMD (note: no quotes):
SET ASPNETCORE_URLS=https://*:5123 && dotnet run
View static_c_types_c#.cs
// User defined type
int myUserDefinedTypeNumber = 1;
string myUserDefinedTypeString = "Hello";
bool myUserDefinedTypeBool = true;
// Compiler defined type
var myCompilerDefinedTypeNumber = 1;
var myCompilerDefinedTypeString = "Hello";
var myCompilerDefinedTypeBool = true;
View using_example_c#_forensics.cs
using (var file = File.OpenRead(CARD_ROOT_PATH + "card.raw"))
{
// Code which uses the file object
}
View asp_core_project_ignore_node_modules.json
{
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"exclude": [ "node_modules" ]
}
},
"tools": {
"SomeToolsRemovedForBrevity": true
View cascade_delete_efcore_example.cs
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata;
public class MyDBContext : DBContext
{
public DbSet<Blog> Blog { get; set; }
public DbSet<Post> Posts { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
View panel_bs3_example.html
<!-- http://getbootstrap.com/components/#panels -->
<div class="row">
<div class="col-md-2">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
View .gitconfig
# Colour settings best suited to a terminal with a dark background
[color "status"]
added = white green bold
changed = yellow reverse
untracked = white red bold
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]