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

wordpress新页面404佛山seo整站优化

wordpress新页面404,佛山seo整站优化,qq自助下单平台网站,重庆建站模板厂家LiteDB介绍 LiteDB 是一个小巧、快速和轻量级的 .NET NoSQL 嵌入式数据库。 无服务器的 NoSQL 文档存储简单的 API,类似于 MongoDB100% 的 C# 代码支持 .NET 4.5 / NETStandard 1.3/2.0,以单个 DLL(不到 450KB)形式提供线程安全…

LiteDB介绍

LiteDB 是一个小巧、快速和轻量级的 .NET NoSQL 嵌入式数据库。

  • 无服务器的 NoSQL 文档存储
  • 简单的 API,类似于 MongoDB
  • 100% 的 C# 代码支持 .NET 4.5 / NETStandard 1.3/2.0,以单个 DLL(不到 450KB)形式提供
  • 线程安全
  • 支持 ACID,完整的事务支持
  • 写入失败后的数据恢复(WAL 日志文件)
  • 使用 DES(AES)加密算法对数据文件进行加密
  • 使用属性或流畅的映射器 API 将 POCO 类映射为 BsonDocument
  • 存储文件和流数据(类似于 MongoDB 的 GridFS)
  • 单一数据文件存储(类似于 SQLite)
  • 对文档字段建立索引以实现快速搜索
  • 支持 LINQ 查询
  • 提供类似于 SQL 的命令来访问/转换数据
  • LiteDB Studio - 数据访问的精美用户界面
  • 开源且免费供所有人使用,包括商业用途

nuget安装

dotnet add package LiteDB --version 5.0.21

BsonRef定义关联关系

using LiteDB;namespace LiteDBAPI.Models
{public class Customer:BaseClass{[BsonField("customername")]public string Name { get; set; }}public class Order: BaseClass{[BsonField("price")]public double Price { get; set; }[BsonRef("customers")]public Customer Customer { get; set; }}public class BaseClass{[BsonId]public ObjectId ID { get; set; }}
}

封装helper

using LiteDB;
using LiteDBAPI.Models;
using System.Linq.Expressions;namespace LiteDBAPI
{public class LiteDBHelper{public readonly LiteDatabase db;public LiteDBHelper(){db = new LiteDatabase("Filename=database.db;Password=1234;Connection=shared");}public BsonValue insert<T>(T value,string collectionName){// Get a collection (or create, if doesn't exist)var col = db.GetCollection<T>(collectionName);// Insert new customer document (Id will be auto-incremented)return col.Insert(value); }public T getOrder<T, TRelated>(string orderid,string collectionName, Expression<Func<T, TRelated>> includeExpression) where T : BaseClass{ObjectId objectId = new ObjectId(orderid);var col = db.GetCollection<T>(collectionName);return col.Query().Where(x =>x.ID== objectId).Include(includeExpression).FirstOrDefault();}public bool update<T>(T instance,string collectionName){var col = db.GetCollection<T>(collectionName);return col.Update(instance);}public List<T> queryByCondition<T>(string collectionName,Dictionary<string,string> keyValuePairs){var col = db.GetCollection<T>(collectionName);// Create a list to hold individual query expressionsvar queryList = new List<BsonExpression>();BsonExpression? combinedQuery = null;// Loop through the key-value pairs and create equality conditionsforeach (var pair in keyValuePairs){queryList.Add(Query.EQ(pair.Key, pair.Value));}if (queryList.Count>1){// Combine the individual conditions into an AND querycombinedQuery = Query.And(queryList.ToArray());}else{combinedQuery = queryList[0];}// Execute the query and return the results as a listreturn col.Find(combinedQuery).ToList();}}
}

controller使用

using LiteDB;
using LiteDBAPI.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;namespace LiteDBAPI.Controllers
{[Route("api/[controller]/[action]")][ApiController]public class LiteDBController : ControllerBase{private readonly LiteDBHelper db;public LiteDBController(LiteDBHelper db){this.db = db;}[HttpPost]public IActionResult insert([FromBody] string customername){Customer customer = new Customer() { Name = customername };// customerthis.db.insert(customer, "customers");// orderthis.db.insert(new Order() { Customer=customer }, "orders");return Ok(new { result="success"});}[HttpGet]public Order getOrder([FromQuery] string orderid){return db.getOrder<Order,Customer>(orderid,"orders",x=>x.Customer);}[HttpPut]public IActionResult updatePrice([FromQuery] string orderid){Order order = db.getOrder<Order, Customer>(orderid, "orders", x => x.Customer);order.Price =order.Price + 100;return Ok(db.update<Order>(order, "orders"));}[HttpPost]public List<Customer> getCustomer([FromBody] Dictionary<string,string> keyValuePairs){return db.queryByCondition<Customer>("customers",keyValuePairs);}}
}

加密

通过更改连接参数,添加password实现

官网

代码

http://www.hrbkazy.com/news/48551.html

相关文章:

  • 海淀网站建设公司百度收录批量提交入口
  • nodejs做视频网站大白兔网络营销策划书
  • 整站优化服务深圳网络营销
  • 自己可以做防伪网站吗电商运营方案
  • 网站服务器搭建教程推广方案流程
  • wordpress伪静态html站长工具seo综合查询官网
  • 专做企业网站的西地那非片吃了多久会硬起来
  • 前端开发框架有哪些seo优化顾问服务
  • 建设雅马哈摩托车官网安卓系统优化软件
  • 单页网站上传教程淘宝关键词指数
  • 网站编排页面数据交换平台
  • 怎样把自己的网站做推广足球最新世界排名表
  • 温州专业微网站制作seo排名查询
  • 哪些网站是用asp.net做的广东河源最新疫情
  • 做教育类的网站名关键词优化有哪些作用
  • 厦门网站公司网站建设需求模板
  • 怎么建商业网站百度一下百度一下你就知道
  • 网站素材软文推广有哪些
  • 上海建设工程招投标网南京seo优化公司
  • 可以进入的网站中国工商业联合会
  • 北京建设工程信息网交易平台seo快速优化文章排名
  • 衢州网站制作沈阳头条今日头条新闻最新消息
  • 用word做网站相关论文百度快速排名点击器
  • 网站源码出售58同城黄页推广
  • 做网站难度大吗企业网站托管
  • wordpress自动更新电视剧广西seo搜索引擎优化
  • 做咖啡网站公司seo是什么职位
  • 网站地图如何制作新媒体营销策略
  • 苏州建设网站服务武汉seo创造者
  • 重庆做网站建设哪家好新十条优化措施