C#/EFCore
-
[EFCore] reset sqlite_sequenceC#/EFCore 2023. 10. 12. 10:57
Reset an AUTOINCREMENT field in SQLite sqlite_sequence : Primary Key 자동 증가시 생기는 테이블 name : Table이름 sq : 현재 자동 증가된 숫자 모든 테이블 데이타 삭제하더라도 sqlite_sequence 테이블 data를 삭제 하지 않으면 seq 이후의 값으로 Key값 자동 증가 https://www.vbforums.com/showthread.php?861479-RESOLVED-Reset-an-AUTOINCREMENT-field-in-SQLite VBForums Message No Thread specified. If you followed a valid link, please notify the administrator Click Her..
-
[EFCore] Grpc Data ParsingC#/EFCore 2023. 9. 21. 16:07
DbContext로 db 에서 불러온 Data Pasing할 때 외래키로 들고 있는 DataType포함 하여 쿼리하는 방법. public static List ReadAllTagDB(string TagDbName = null) { using var tagContext = new TagDbContext(); try { //tagContext.DbPath = Path.Combine(DbWorkingPath, TagDbName + ".db"); //var findTag = tagContext.Tags.Any(x => x.Id == TagId); //var readTag = tagContext.Tags.Where(x => x.Id == TagId).FirstOrDefault(); //Include(r=>r.De..
-
[EFCore] SQLite .db 사용시 CloseC#/EFCore 2023. 8. 29. 11:42
Sqlite .db 사용 시 어플리케이션 종료할 때 까지 위 3개의 파일이 생성 되는데 .db 는 비어 있고 실제 파일은 .db-wal파일에 쓰인다. WAL - 3.7.0 에는 WAL ( Write Ahead to Log ) 방식이 새로 도입되었다. 이 녀석도 journal 과 마찬가지로 atomic commit 과 rollback 을 지원하기 위함이다. 이 녀석은 -wal 형태를 갖는다. - WAL file 은 DB connection 이 처음 이뤄질 때 생성되고, last connection 이 close 될 때 제거된다. 그러나 예외상황이 발생하면 (정상종료하지 않으면) WAL 파일은 남게 되고, 다음에 DB open 시 이 정보를 이용해 DB 를 원상복구 한다. - 모든 process 의 SQLi..
-
[EFCore] 시작하기C#/EFCore 2022. 11. 9. 17:29
Nuget_Package 설치 Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore.Tools using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EFTest.Models { [Table("Employee")] //테이블 이름 ..