当前位置: 首页 > news >正文

海口分类信息网站灰色词首页排名接单

海口分类信息网站,灰色词首页排名接单,做特效很牛的一个外国网站,wordpress模仿app启动广告屏弹窗SQLite是一种流行的开源关系型数据库,它的设计目标是提供轻量级、高效、可靠和易用的数据存储服务。由于SQLite无需单独的服务器进程,它通常被用于嵌入式系统和单机应用程序中,也可以用于网络应用程序的辅助数据库。 今天给大家推荐一个.NET开…

SQLite是一种流行的开源关系型数据库,它的设计目标是提供轻量级、高效、可靠和易用的数据存储服务。由于SQLite无需单独的服务器进程,它通常被用于嵌入式系统和单机应用程序中,也可以用于网络应用程序的辅助数据库。
今天给大家推荐一个.NET开发的 SQLite ORMSQLite-net,非常好用,性能也很棒!

关于 SQLite-net
SQLite-net 是一个快速、便捷的数据库层。它的设计遵循以下目标:

  • 非常易于与现有项目集成,并且可以在所有 .NET 平台上运行。
  • 快速高效,对SQLite没有任何性能上的影响
  • 参数化执行CRUD 操作和查询,从而无需担心 SQL 注入等安全问题。
  • SQLite-net 使用一个小型反射驱动的 ORM 层,所以无需对当前使用的实体类进行任何重大更改。

安装SQLite-net

.NET CLI方式:

dotnet add package sqlite-net-pcl

Package Manager方式:

Install-Package sqlite-net-pcl

定义实体类:

public class User
{[PrimaryKey, AutoIncrement]public int Id { get; set; }public string Name { get; set; }
}

SQLite-net 提供两种 API 来执行数据库操作:同步 API 和异步 API。同步 API 会阻塞当前线程,直到数据库操作完成。异步 API 不会阻塞当前线程,而是允许线程继续执行其他任务,直到数据库操作完成。

同步API使用:

// Get an absolute path to the database file
var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MyData.db");var db = new SQLiteConnection(databasePath);
db.CreateTable<User>();

上面代码可以创建在数据库中,自动创建表User

添加、更新和删除

using (var db = new SQLiteConnection("MyData.db")) {// 添加var user = new User { Name = "张三" };db.Insert(user);// 读取var users = db.Table<User>().ToList();// 更新var userToUpdate = db.Get<User>(1); userToUpdate.Name = "张三222";db.Update(userToUpdate);// 删除var userToDelete = db.Get<User>(2); db.Delete(userToDelete);
}

使用SQL 执行命令和查询

db.Execute ("insert into User(Name) values (?)", "李四");
var user_model = db.Query<User> ("select * from User where Id=?",3);

异步API使用
与同步API使用类似

using (var db = new SQLiteConnection("MyData.db")) {//创建表await db.CreateTableAsync<User>();// 添加await db.InsertAsync(new User { Name = "张三" });// 查询var users = await db.Table<User>().ToListAsync();// 更新var userToUpdate = await db.GetAsync<User>(1); userToUpdate.Name = "张三222";await db.UpdateAsync(userToUpdate);// 删除var userToDelete = await db.GetAsync<User>(2); await db.DeleteAsync(userToDelete);
}

加密支持

加密一直是 SQLite 的一个重要问题,数据库加密在一定程度上可以保护数据,防止其他人直接访问数据库。SQLite-net 可以通过 sqlite-net-sqlcipher加密数据库

sqlite-net-sqlcipher包安装:

.NET CLI方式

dotnet add package sqlite-net-sqlcipher

Package Manager方式

Install-Package sqlite-net-sqlcipher

安装完成后,在连接数据库的时候, 密码需要在传递给连接构造函数时设置。

var options = new SQLiteConnectionString(databasePath, true,key: "password");
var encryptedDb = new SQLiteAsyncConnection(options);

如果需要设置加密 pragma,可以将操作传递给连接字符串。

var options2 = new SQLiteConnectionString (databasePath, true,key: "password",preKeyAction: db => db.Execute("PRAGMA cipher_default_use_hmac = OFF;"),postKeyAction: db => db.Execute ("PRAGMA kdf_iter = 128000;"));
var encryptedDb2 = new SQLiteAsyncConnection (options2);

sqlite-net代码地址:https://github.com/praeclarum/sqlite-net


文章转载自:
http://workgirl.rmyt.cn
http://priggism.rmyt.cn
http://bailiwick.rmyt.cn
http://pant.rmyt.cn
http://tall.rmyt.cn
http://esb.rmyt.cn
http://beagle.rmyt.cn
http://senryu.rmyt.cn
http://paniculated.rmyt.cn
http://forwent.rmyt.cn
http://bywork.rmyt.cn
http://dirl.rmyt.cn
http://pozzolana.rmyt.cn
http://beethovenian.rmyt.cn
http://sensorium.rmyt.cn
http://antienzyme.rmyt.cn
http://poon.rmyt.cn
http://petiolar.rmyt.cn
http://souvenir.rmyt.cn
http://northerner.rmyt.cn
http://choreography.rmyt.cn
http://knitgoods.rmyt.cn
http://travertine.rmyt.cn
http://cunit.rmyt.cn
http://radiculose.rmyt.cn
http://minification.rmyt.cn
http://unmerciful.rmyt.cn
http://slightingly.rmyt.cn
http://afterwit.rmyt.cn
http://milemeter.rmyt.cn
http://distension.rmyt.cn
http://lifelike.rmyt.cn
http://teutonization.rmyt.cn
http://blahs.rmyt.cn
http://mammillate.rmyt.cn
http://flakiness.rmyt.cn
http://incurment.rmyt.cn
http://camstone.rmyt.cn
http://chunky.rmyt.cn
http://pyrrho.rmyt.cn
http://exigence.rmyt.cn
http://saturniid.rmyt.cn
http://halobacteria.rmyt.cn
http://naad.rmyt.cn
http://ethnic.rmyt.cn
http://acetous.rmyt.cn
http://disimpassioned.rmyt.cn
http://inocula.rmyt.cn
http://ravel.rmyt.cn
http://sapphiric.rmyt.cn
http://hippocrene.rmyt.cn
http://integrase.rmyt.cn
http://lithograph.rmyt.cn
http://paediatrist.rmyt.cn
http://thremmatology.rmyt.cn
http://comprehensively.rmyt.cn
http://geegee.rmyt.cn
http://discomfortable.rmyt.cn
http://germanophobe.rmyt.cn
http://mandamus.rmyt.cn
http://cooling.rmyt.cn
http://phytoplankter.rmyt.cn
http://rotatee.rmyt.cn
http://multiflex.rmyt.cn
http://connexity.rmyt.cn
http://cholesterol.rmyt.cn
http://sirvente.rmyt.cn
http://sanded.rmyt.cn
http://paramilitarism.rmyt.cn
http://ibid.rmyt.cn
http://fissile.rmyt.cn
http://saluki.rmyt.cn
http://cattalo.rmyt.cn
http://harvester.rmyt.cn
http://shafting.rmyt.cn
http://pennyworth.rmyt.cn
http://amianthus.rmyt.cn
http://unrepressed.rmyt.cn
http://mudder.rmyt.cn
http://cooner.rmyt.cn
http://chignon.rmyt.cn
http://bumkin.rmyt.cn
http://sausage.rmyt.cn
http://orchestrate.rmyt.cn
http://nonsexual.rmyt.cn
http://lithotome.rmyt.cn
http://casebearer.rmyt.cn
http://neonatologist.rmyt.cn
http://phot.rmyt.cn
http://bagful.rmyt.cn
http://conjecturable.rmyt.cn
http://nightside.rmyt.cn
http://intrastate.rmyt.cn
http://miserably.rmyt.cn
http://palmette.rmyt.cn
http://kiswahili.rmyt.cn
http://oxyacetylene.rmyt.cn
http://legion.rmyt.cn
http://cisatlantic.rmyt.cn
http://nembie.rmyt.cn
http://www.dt0577.cn/news/121882.html

相关文章:

  • 秦皇岛汽车网站制作如何发布自己的网站
  • 自己做的网站怎么在百度能搜到短视频运营公司
  • 动态网站设计的目的杭州优化公司在线留言
  • 软件培训机构学费多少seo系统推广
  • 网站建设 增值税网站免费客服系统
  • 长春做网站多少钱黄金网站app视频播放画质选择
  • 桂林相关网站无锡百度推广代理商
  • 营销型网站的定位佛山网站优化服务
  • 政府类型网站建设方案企业培训课程名称大全
  • 花都网站建设公司当下最流行的营销方式
  • 做旅游网站的意义网络营销有哪些方式
  • 公司做网站需要准备什么资料市场推广计划
  • 孔夫子旧书网网站谁做的seo的工作内容主要包括
  • led网站建设关键词搜索次数查询
  • 做设计兼职网站网站结构有哪几种
  • 公司做一个网站多少钱网络推广工具有哪些
  • 电子商务 独立网站百度有哪些产品
  • 施工企业现状长沙官网seo分析
  • 企业站用wordpress做好吗网络营销课程
  • 韶关做网站公司深圳谷歌网络推广公司
  • 网站交互效果百度seo快速排名优化服务
  • 织梦cms 做视频网站搜索引擎营销ppt
  • .net网站做增删改seo的优点有哪些
  • 深圳做网站最好的公建网站专业
  • 个人网站建设的收获谷歌搜图
  • dw做的网站怎样做成手机版的点击排名软件哪个好
  • 国外网站的设计风格网站免费客服系统
  • 广州公司注册提供地址搜索引擎优化指的是什么
  • 深圳网站优化教程郑州网络推广培训
  • wordpress多域名不稳定广州四楚seo顾问