Microsoft MVP성태의 닷넷 이야기
.NET Framework: 214. 무료 Linq Provider - DbLinq를 이용한 Firebird 접근 [링크 복사], [링크+제목 복사],
조회: 31364
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일

무료 Linq Provider - DbLinq를 이용한 Firebird 접근

지난번에, 유료 제품인 ALinq를 이용한 Firebird 접근을 알아봤었지요.

Linq To SQL - ALinq Provider를 이용하여 Firebird 사용
; https://www.sysnet.pe.kr/2/0/1041

이번엔 ^^ 무료로 구할 수 있는 Linq provider를 알아볼 텐데요. 바로 오픈 소스로 제공되는 DbLinq가 되겠습니다.

LINQ provider for Oracle, PostgreSQL, MySQL, Ingres, SQLite, Firebird and ... SQL Server (C# 3.0)
; http://code.google.com/p/dblinq2007/

ALinq처럼 다양한 Provider를 제공하는데 다행히 Firebird도 같이 지원하고 있습니다. 소스 코드도 함께 제공이 되는데, 여기서는 빌드된 DLL로 곧바로 사용법만 빠르게 알아보겠습니다.

현재 (2011-05-22) DbLinq 0.20.1 버전이 릴리스 된 상태이고, 다음의 경로에서 Sources / Binaries를 다운로드할 수 있습니다.

dblinq2007 다운로드 (마지막 업데이트가 작년 4월이니 1년이 넘었는데... 그다지 변화가 많지는 않은 것 같습니다.)
; http://code.google.com/p/dblinq2007/downloads/list

구조 자체는 ALinq와 유사한데, 압축을 풀어 다음의 2가지만 취하면 됩니다.

  • DbLinq.dll
  • DbLinq.Firebird.dll

물론, FirebirdSql.Data.FirebirdClient.dll은 기본적으로 필요하겠고.




지난번의 ALinq와는 사용 방법이 다소 다릅니다. DbLinq의 경우 DataContext는 반드시 DB Connection 개체를 받는 생성자를 정의해야 합니다.

public partial class TestDatabaseContext : DbLinq.Firebird.FirebirdDataContext
{
    public TestDatabaseContext(IDbConnection connection)
        : base(connection)
    {
    }

    public DbLinq.Data.Linq.Table<TestTable> TestTables
    {
        get
        {
            return this.GetTable<TestTable>();
        }
    }
}

그래서 사용방법이 다음과 같은 식으로 FirebirdSql.Data.FirebirdClient.FbConnection을 외부에서 정의해서 넘겨주는 것으로 바뀝니다.

using (var fbCon 
    = new FbConnection(ConfigurationManager.ConnectionStrings["TestDB"].ConnectionString))
{
    TestDatabaseContext dc = new TestDatabaseContext(fbCon);
}

문제가 있다면, 몇몇 DataContext 내의 API가 아직 미구현이라는 점입니다. 이전의 ALinq 예제에서는 다음과 같은 코드를 포함시켰는데,

if (dc.DatabaseExists())
{
    dc.DeleteDatabase();
}

dc.CreateDatabase();

DbLinq에서는 위의 3가지 API들이 미구현되었거나 / 정상적으로 동작하지 않습니다. 가령, DatabaseExists는 다음과 같은 First-chance 예외를 발생시키고,

A first chance exception of type 'FirebirdSql.Data.FirebirdClient.FbException' occurred in FirebirdSql.Data.FirebirdClient.dll

Additional information: Dynamic SQL Error
SQL error code = -104
Unexpected end of command - line 1, column 8

CreateDatabase 및 DeleteDatabase는 아직 구현되어 있지 않다는 오류만 뜹니다.

An unhandled exception of type 'System.NotImplementedException' occurred in DbLinq.dll

Additional information: The method or operation is not implemented.

그 외에는 일단 기초적인 테스트에 한해서는 지난번 ALinq와 동일한 동작이 수행되었습니다.

개인적인 의견으로, ALinq가 확실히 유료 제품으로써 더 믿음이 갑니다. 반면, DbLinq는 다소 불안한 상태라고 봐야겠지요. 만약 여러분들이 DbLinq로 프로젝트를 하기로 마음먹었다면, '마음 먹는 수준'에서 그치지 말고 본격적인 프로젝트 진행 전에 다양한 상황에서의 충분한 테스트를 거치는 것이 좋을 것 같습니다.

게다가, 이전 "Linq To SQL - ALinq Provider를 이용하여 Firebird 사용" 글에서도 살짝 비춰지고 있지만, ALinq 측의 기술 대응이 매우 신속하다는 점도 빼놓을 수 없는 장점입니다. (일례로, 제가 일요일에 보낸 TransactionScope 관련 문의 메일은 약 3시간 만에 답장을 받았고, 응답자의 보낸 시간은 토요일 오후 11시 55분이었습니다. 이 정도면, 믿을만한 기술지원 수준일 것 같습니다. ^^)

* 첨부된 코드는 테스트 프로젝트입니다.



[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 6/27/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 76  77  78  79  80  81  82  83  [84]  85  86  87  88  89  90  ...
NoWriterDateCnt.TitleFile(s)
11836정성태3/5/201923266오류 유형: 525. Visual Studio 2019 Preview 4/RC - C# 8.0 Missing compiler required member 'System.Range..ctor' [1]
11835정성태3/5/201921759.NET Framework: 810. C# 8.0의 Index/Range 연산자를 .NET Framework에서 사용하는 방법 및 비동기 스트림의 컴파일 방법 [3]파일 다운로드1
11834정성태3/4/201920594개발 환경 구성: 432. Visual Studio 없이 최신 C# (8.0) 컴파일러를 사용하는 방법
11833정성태3/4/201921107개발 환경 구성: 431. Visual Studio 2019 - CMake를 이용한 공유/실행(so/out) 리눅스 프로젝트 설정파일 다운로드1
11832정성태3/4/201917030오류 유형: 524. Visual Studio CMake - rsync: connection unexpectedly closed
11831정성태3/4/201916861오류 유형: 523. Visual Studio 2019 - 새 창으로 뜬 윈도우를 닫을 때 비정상 종료
11830정성태2/26/201916566오류 유형: 522. 이벤트 로그 - Error opening event log file State. Log will not be processed. Return code from OpenEventLog is 87.
11829정성태2/26/201918298개발 환경 구성: 430. 마이크로소프트의 CoreCLR 프로파일러 예제 빌드 방법 - 리눅스 환경 [1]
11828정성태2/26/201926164개발 환경 구성: 429. Component Services 관리자의 RuntimeBroker 설정이 2개 있는 경우 [8]
11827정성태2/26/201919096오류 유형: 521. Visual Studio - Could not start the 'rsync' command on the remote host, please install it using your system package manager.
11826정성태2/26/201919273오류 유형: 520. 우분투에 .NET Core SDK 설치 시 패키지 의존성 오류
11825정성태2/25/201924496개발 환경 구성: 428. Visual Studio 2019 - CMake를 이용한 리눅스 빌드 환경 설정 [1]
11824정성태2/25/201918964오류 유형: 519. The SNMP Service encountered an error while accessing the registry key SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration. [1]
11823정성태2/21/201920623오류 유형: 518. IIS 관리 콘솔이 뜨지 않는 문제
11822정성태2/20/201918937오류 유형: 517. docker에 설치한 MongoDB 서버로 연결이 안 되는 경우
11821정성태2/20/201919696오류 유형: 516. Visual Studio 2019 - This extension uses deprecated APIs and is at risk of not functioning in a future VS update. [1]
11820정성태2/20/201922780오류 유형: 515. 윈도우 10 1809 업데이트 후 "User Profiles Service" 1534 경고 발생
11819정성태2/20/201922049Windows: 158. 컴퓨터와 사용자의 SID(security identifier) 확인 방법
11818정성태2/20/201920119VS.NET IDE: 131. Visual Studio 2019 Preview의 닷넷 프로젝트 빌드가 20초 이상 걸리는 경우 [2]
11817정성태2/17/201916488오류 유형: 514. WinDbg Preview 실행 오류 - Error : DbgX.dll : WindowsDebugger.WindowsDebuggerException: Could not load dbgeng.dll
11816정성태2/17/201919906Windows: 157. 윈도우 스토어 앱(Microsoft Store App)을 명령행에서 직접 실행하는 방법
11815정성태2/14/201918135오류 유형: 513. Visual Studio 2019 - VSIX 설치 시 "The extension cannot be installed to this product due to prerequisites that cannot be resolved." 오류 발생
11814정성태2/12/201917010오류 유형: 512. VM(가상 머신)의 NT 서비스들이 자동 시작되지 않는 문제
11813정성태2/12/201918331.NET Framework: 809. C# - ("Save File Dialog" 등의) 대화 창에 확장 속성을 보이는 방법
11812정성태2/11/201915640오류 유형: 511. Windows Server 2003 VM 부팅 후 로그인 시점에 0xC0000005 BSOD 발생
11811정성태2/11/201920859오류 유형: 510. 서버 운영체제에 NVIDIA GeForce Experience 실행 시 wlanapi.dll 누락 문제
... 76  77  78  79  80  81  82  83  [84]  85  86  87  88  89  90  ...