Skip to content

Instantly share code, notes, and snippets.

@ichiroku11
ichiroku11 / Program.cs
Created March 25, 2017 00:25
Getterのみの自動実装プロパティの初期化子のメモ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp {
class Sample {
private static int GetValue([CallerMemberName]string caller = null) {
@ichiroku11
ichiroku11 / te_to_xe.sql
Created May 24, 2017 23:38
トレースイベントと拡張イベントの対応を確認するクエリ
select
te.trace_event_id as te_event_id,
te.name as te_event_name,
xe.package_name as xe_package_name,
xe.xe_event_name as xe_event_name
from sys.trace_events as te
inner join sys.trace_xe_event_map as xe
on te.trace_event_id = xe.trace_event_id
where
te.name in (N'RPC:Completed', N'SQL:BatchCompleted');
@ichiroku11
ichiroku11 / xe_data.sql
Last active June 8, 2017 23:35
拡張イベントのイベントデータを確認するクエリ
select
xe_p.name as package_name,
xe_o.name as event_name,
xe_oc.name as column_name,
xe_oc.column_type as column_type,
xe_oc.type_name as type_name,
xe_oc.description as column_description,
*
from sys.dm_xe_packages as xe_p
inner join sys.dm_xe_objects as xe_o
@ichiroku11
ichiroku11 / xe_target.sql
Created June 8, 2017 23:40
拡張イベントのターゲットのオプションを確認するクエリ
select
xe_p.name as package_name,
xe_o.name as target_name,
xe_oc.name as column_name,
xe_oc.column_type as column_type,
xe_oc.type_name as type_name,
xe_oc.description as column_description,
*
from sys.dm_xe_packages as xe_p
inner join sys.dm_xe_objects as xe_o
@ichiroku11
ichiroku11 / Program.cs
Last active August 19, 2017 03:48
拡張イベントを試す
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
namespace ConsoleApp {
class Program {
@ichiroku11
ichiroku11 / app.css
Created August 1, 2017 07:40
CSS transitionを試す
.container .box {
background-color: #e4efff;
width: 100px;
margin-bottom: 10px;
padding: 1em 0.1em;
text-align: center;
}
.container:hover .box {
background-color: #ffefe4;
@ichiroku11
ichiroku11 / AppDbContext.cs
Last active September 13, 2017 13:20
EF Coreはじめました
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;
using Microsoft.EntityFrameworkCore;
namespace ConsoleApp {
public class AppDbContext : DbContext {
public DbSet<Monster> Monsters { get; set; }
@ichiroku11
ichiroku11 / Program.cs
Last active September 17, 2017 10:55
EF Coreでログ出力
using System;
using System.Data.SqlClient;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
namespace ConsoleApp {
@ichiroku11
ichiroku11 / Program.cs
Last active December 18, 2018 11:35
EF CoreのIncludeとThenInclude
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
@ichiroku11
ichiroku11 / Character.sql
Created October 21, 2017 14:32
EF CoreのOwned typesのサンプル
use Test;
begin tran;
-- テーブル作成
drop table if exists dbo.Character;
create table dbo.Character(
Id int,
Name nvarchar(4) not null,
Level int not null,