简体   繁体   English

为SQLite创建ADO.NET适配器

[英]Create ADO.NET adaptor for SQLite

How to create a ADO.NET adaptor for SQLite (ie generate my own DLLs from SQLite C source code, instead of using other existing DLLs or NuGet to install SQLite.) I want to do it as a learning experience but find no instruction on google. 如何为SQLite创建ADO.NET适配器(即从SQLite C源代码生成我自己的DLL,而不是使用其他现有的DLL或NuGet来安装SQLite。)我想作为学习经验来做,但在Google上找不到说明。

I will use C#.NET in WPF VS2015 on x64. 我将在x64上的WPF VS2015中使用C#.NET。 Do I compile the source in VC++ as a DLL and then reference to it in a new solution ? 我是否将VC ++中的源代码编译为DLL,然后在新的解决方案中对其进行引用? Will the DLL be x86 and x64 compatible or do I generate two separate DLLs? 该DLL是否与x86和x64兼容,还是我生成两个单独的DLL?

That's a big undertaking for a learning project, but ok. 对于学习项目而言,这是一项艰巨的任务,但是可以。 Curious though, why VC++? 但是很好奇,为什么要使用VC ++? You can create a C# class library and access the sqlite dll via PInvoke, then create your public interface around those. 您可以创建一个C#类库并通过PInvoke访问sqlite dll,然后围绕它们创建您的公共接口。 This will also make it easier to derive from the base ADO.NET classes that will make it suitable as an actual ADO provider library. 这也将使从基础ADO.NET类派生变得容易,这将使其适合作为实际的ADO提供程序库。

For x86 vs x64, it depends. 对于x86与x64,要视情况而定。 You can use all x86 calls to sqlite regardless of the target architecture, or you can split them into separate architectures if you wish to use the x64 specifics for 64bit releases. 无论目标体系结构是什么,都可以使用所有x86调用sqlite,或者如果希望对64位发行版使用x64规范,则可以将它们拆分为单独的体系结构。 Personally, I wouldn't worry about this aspect too much until I had a good handle on the fundamentals of creating the actual wrapper/library/provider. 就我个人而言,除非我对创建实际包装器/库/提供者的基础知识有足够的了解,否则我不会对此太担心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM