|
출처 : https://dotnetcoretutorials.com/2017/01/17/api-versioning-asp-net-core/
|
Install-Package Microsoft.AspNetCore.Mvc.Versioning |
startup.cs
|
public void ConfigureServices(IServiceCollection services) { // ApiVersioning을 추가 services.AddApiVersioning(options => { // 클라이언트에 Api 버전을 통지 options.ReportApiVersions = true; // 이것이 없으면 클라이언트 측에서 에러가 나온다 options.AssumeDefaultVersionWhenUnspecified = true; // Api의 default 버전을 1.0으로 설정 options.DefaultApiVersion = new ApiVersion(1, 0); }); } |
출처에 보면 여러가지 방식(Url Query Based Versioning, URL Path Based Versioning, Http Header Based Versiong) 등이 있으나…
역시 익숙한 방식은
|
[ApiVersion("1.0")] [Route("api/{version:apiVersion}/home")] public class HomeV1Controller : Controller { [HttpGet] public string Get() => "v1"; } [ApiVersion("2.0")] [Route("api/{version:apiVersion}/home")] public class HomeV2Controller : Controller { [HttpGet] public string Get() => "v2"; } |
혹은
|
[ApiVersion("1.0")] [ApiVersion("2.0")] [Route("v{version:apiVersion}/[controller]")] public class HomeController : Controller { [HttpGet] public string Get() => "v1"; // Api 버전을 덮어 쓰기 [HttpGet, MapToApiVersion("2.0")] public string GetV2() => "v2"; } |
/v1/Home, /v2/Home 의 형식으로 call 가능함
프로젝트용 폴더 생성
main.go 파일 생성
|
package main import "fmt" func main() { fmt.Println("hello world") } |
vscode 로 폴더 열기
F5 로 실행 -> Error
dlv 파일이 없어서 생긴 문제 인것 같아서 일단 delve 패키지 install
하지만
|
go: go.mod file not found in current directory or any parent directory; see 'go help modules' |
터미널에서
|
go env -w GO111MODULE=auto |
F5 로 실행 및 디버깅
그리고 vscode의 환경설정에 아래 코드 추가
|
"go.toolsManagement.autoUpdate": true, |
in 매개 변수
|
// 여기서의 in은 ref readonly처럼 작동함 함수 call시에는 in을 쓰거나 말거나 동일 void PrintDate(in DateTime date) { Console.WriteLine(date); } |
null 관련 연산자
|
// 오래전 instance = instance == null ? value : instance; // 기존 instance = instance ?? value; // 현재 instance ??= value; |
Auto Property
|
// C# 6.0 Auto property public string Name { get; set; } = "Karu"; |
Index 연산
|
// C# 8.0 인덱스 연산 string str = "Rolling Ress"; var last = str[^1]; // 's' var sub = str[0..4]; // "Roll", 구간은 [0, 4) |
그때 그때 사용하지 않는 것을 Disable 해서 쓴다.
Auto Rename Tag Bootstrap 4, Font awesome4, Font Awesome5 Free & Pro snippets Bootstrap 5 Snippets C/C++ C# C# Extensions CSS Peek Debugger for Chrome DotENV ES7 React/Redux/GraphQL/React-Native snippets Font Awesome Auto-complete & Preview Git History GitLens Git supercharged Go Highlight Matching Tag Html (C#) HTML […]
ICollection 사용
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
public ICollection<Student> m_listLandSiteDataText { get; set; } protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<int>( name: "CourseId", table: "Students", nullable: true); migrationBuilder.CreateIndex( name: "IX_Students_CourseId", table: "Students", column: "CourseId"); migrationBuilder.AddForeignKey( name: "FK_Students_Courses_CourseId", table: "Students", column: "CourseId", principalTable: "Courses", principalColumn: "CourseId", onDelete: ReferentialAction.Restrict); } |
Index와 ForeignKey 없이 생성
|
[ForeignKey("Course")] public int CourseId { get; set; } [ForeignKey("CourseId")] public int CourseId { get; set; } protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<int>( name: "CourseId", table: "Students", nullable: false, defaultValue: 0); } |
virtual 사용시
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
public int CourseId { get; set; } [ForeignKey("CourseId")] public virtual Course m_mvLandSiteDataImage { get; set; } protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<int>( name: "CourseId", table: "Students", nullable: false, defaultValue: 0); migrationBuilder.CreateIndex( name: "IX_Students_CourseId", table: "Students", column: "CourseId"); migrationBuilder.AddForeignKey( name: "FK_Students_Courses_CourseId", table: "Students", column: "CourseId", principalTable: "Courses", principalColumn: "CourseId", onDelete: ReferentialAction.Cascade); } |
vscode에 launch.json
|
{ // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요. // 기존 특성에 대한 설명을 보려면 가리킵니다. // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요. "version": "0.2.0", "configurations": [ { "name": "Launch Package geth", "type": "go", "request": "launch", "mode": "debug", "program": "${workspaceFolder}/cmd/geth/" // main.go 가 있는 폴더 path } ] } |
node를 실행
vscode에 launch.json
|
{ // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요. // 기존 특성에 대한 설명을 보려면 가리킵니다. // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요. "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "launch", "name": "Launch Chrome against localhost", "url": "http://localhost:3000", "webRoot": "${workspaceFolder}/src" } ] } |
터널링 구축
|
ssh -N -L 9221:localhost:9229 [remoteIP] |
node를 inspection 모드로 변경 & 웹 서버 실행
|
node --inspect & yarn start |
vscode에 launch.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
{ // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요. // 기존 특성에 대한 설명을 보려면 가리킵니다. // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요. "version": "0.2.0", "configurations": [ { "address": "localhost", "localRoot": "${workspaceFolder}", "name": "Attach to Remote", "port": 9229, "remoteRoot": "...", "request": "attach", "skipFiles": [ "<node_internals>/**" ], "type": "pwa-node" } ] } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
# Install Dependencies # ----------------------------------------------------------------------------------------------------------- # Build requirements: sudo apt install git build-essential libtool autotools-dev autoconf automake pkg-config bsdmainutils python3 libssl-dev libssl-dev # Install required dependencies sudo apt install libevent-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev # Install the BerkeleyDB from Ubuntu repositories: sudo apt install libdb-dev libdb++-dev libsqlite3-dev # Optional: upnpc sudo apt install libminiupnpc-dev # Optional ZMQ: sudo apt install libzmq3-dev # For GUI: sudo apt install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler # For QR Code support sudo apt install libqrencode-dev # Install Bitcoin # ----------------------------------------------------------------------------------------------------------- git clone https://github.com/bitcoin/bitcoin.git # Move into project directory cd bitcoin # Config # ----------------------------------------------------------------------------------------------------------- # Generate config script ./autogen.sh # If debugging symbols not required, amend compile flags: ./configure --with-incompatible-bdb CXXFLAGS="-O2" # ...lot's of checking... # Make # ----------------------------------------------------------------------------------------------------------- make # Install - sudo is required to install binaries in /usr/local/bin sudo make install |
|
SELECT db_name(st.dbid) DBName , object_schema_name(objectid, st.dbid) SchemaName , object_name(objectid, st.dbid) SPName , qs.total_elapsed_time , creation_time , last_execution_time , text FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.plan_handle)st JOIN sys.dm_exec_cached_plans cp ON qs.plan_handle = cp.plan_handle |
|
|