简体   繁体   English

C#和参数化SQLite,无需通过ADO.NET

[英]C# and parameterized SQLite, WITHOUT going through ADO.NET

Is it possible, and if so, how... To do parameterized queries with SQLite WITHOUT having to go through ADO.NET. 是否可以,如果可以,如何...使用SQLite进行参数化查询,而不必通过ADO.NET。 I've been asked to do some testing with SQLite for a project that needs to have a zero-admin install... ie: no special permissions, things added to windows registry, etc. I would suspect that using an ADO.NET would require such, even though SQLite is just a DLL sitting in the project directory. 我被要求对需要零管理员安装的项目使用SQLite进行一些测试...即:没有特殊权限,没有东西添加到Windows注册表等。我怀疑使用ADO.NET会即使SQLite只是位于项目目录中的DLL,也需要这样。

And yes, I do understand the importance of parameterized queries and issues that can arise out of SQL-Injection if not handled safely. 是的,我确实理解了参数化查询的重要性,以及如果处理不当,可能会由于SQL注入而产生问题。

What makes you think that ADO.NET would require registry entries etc? 是什么让您认为ADO.NET需要注册表项等? It doesn't. 没有。 You just need .NET installed and the appropriate provider assembly. 您只需要安装.NET和适当的提供程序程序集即可。

Now, you won't need all of ADO.NET - for instance, you may well not need the DataTable / DataSet support, if you're happy to use the appropriate DataReader type yourself - but again, if you do want to use them (even strongly typed versions) you shouldn't need any special settings. 现在,您将不需要所有的ADO.NET-例如,如果您很高兴自己使用适当的DataReader类型,则可能完全不需要DataTable / DataSet支持-但是,如果您确实想使用它们,则可能不需要 (甚至是强类型版本),则不需要任何特殊设置。

Of course, it's possible that the SQLite provider has its own requirements around the registry, but I very much doubt it. 当然,SQLite提供程序可能会对注册表有其自己的要求,但我对此非常怀疑。 That would go against my "normal" ADO.NET provider experience, as well as being against the normal usage of SQLite. 那会违背我的“常规” ADO.NET提供程序经验,也违背SQLite的常规用法。

I expect there are various SQLite providers. 我希望有各种SQLite提供程序。 For instance, there's one here which combines the .NET part and the native code of SQLite itself, so there's just the single DLL to deploy alongside your application, as far as I can tell. 例如,这里有一个将.NET部分 SQLite本身的本机代码结合在一起的,所以据我所知,只有一个DLL可以与您的应用程序一起部署。 It doesn't get much simpler than that. 没有比这更简单的了。

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

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