Skip to content

Instantly share code, notes, and snippets.

View AndreasLazar's full-sized avatar

Andreas Lazar AndreasLazar

View GitHub Profile
<ul class="nav navbar-nav">
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
<li><a asp-area="" asp-controller="Speaker" asp-action="Index">Speaker</a></li>
<li><a asp-area="" asp-controller="KnowledgeCircle" asp-action="Index">Knowledge Circles</a></li>
</ul>
{
"ConnectionStrings": {
"DefaultConnection": "DataSource=app.db"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
[...]
using MeineApp.Data;
using Microsoft.EntityFrameworkCore;
namespace MeineApp
{
public class Startup
{
[...]
public void ConfigureServices(IServiceCollection services)
using MeineApp.Models;
using Microsoft.EntityFrameworkCore;
namespace MeineApp.Data
{
public class KcDbContext : DbContext
{
public KcDbContext(DbContextOptions<KcDbContext> options) : base (options) { }
public DbSet<Speaker> Speakers { get; set; }
using System.Collections.Generic;
namespace MeineApp.Models
{
public class Speaker
{
public int ID { get; set; }
public string Vorname { get; set; }
public string Nachname { get; set; }
public string KurzZeichen { get; set; }
using System;
namespace MeineApp.Models
{
public class KnowledgeCircle
{
public int ID { get; set; }
public string Thema { get; set; }
public DateTime Datum { get; set; }
public int SpeakerId { get; set; }
@AndreasLazar
AndreasLazar / JoinWithDifferentCollation.sql
Created February 1, 2012 08:56
Join nvarchar fields with different collation
select sone_field collate SQL_Latin1_General_CP1_CI_AS
from table_1
inner join table_2
on (table_1.field collate SQL_Latin1_General_CP1_CI_AS = table_2.field)
where whatever = whatever
@AndreasLazar
AndreasLazar / CteWithinCursor.sql
Created January 27, 2012 09:15
Using cursor with Common Table Expressions
-- declare a cursor above the CTE definitions
DECLARE myCursor CURSOR FAST_FORWARD_FOR
-- declare CTEs
WITH CTE1 AS
(
-- CTE1 definitiion
)
,CTE2 AS
(
@AndreasLazar
AndreasLazar / findMissingIndexes.sql
Created January 25, 2012 11:06
lists all missing indexes of the current SQL Server
SELECT
DB_NAME(d.database_id) AS database_name
, LEFT (PARSENAME(d.statement, 1), 32) AS table_name
, ISNULL (d.equality_columns , '') AS equality_columns
, ISNULL (d.inequality_columns , '') AS inequality_columns
, ISNULL (d.included_columns , '') AS include_columns
, s.avg_total_user_cost -- This column represent the average total user cost each time when the user query was executed
, s.avg_user_impact -- This column represents the value in percentages. It informs us the amount of improvement which you can get if the index is created.
, s.unique_compiles