Perst我使用的版本是4, 几乎支持所有的.net环境, 而且效率很高,比较稳定。

使用方法:

1:引用相应dll

2: 创建数据结构

public class Cp_struct : Persistent, System.ComponentModel.INotifyPropertyChanged

{

[FullTextIndexable]  // 创建索引

public string Cpph;

public string cpph { get { return this.Cpph; } set { if (this.Cpph != value) { this.Cpph = value; OnPropertyChanged("cpph"); } } }

public string cpmz { get { return this.Cpmz; } set { if (this.Cpmz != value) { this.Cpmz = value; OnPropertyChanged("cpmz"); } } }         public string Cpmz;

public string ddjs { get { return this.Ddjs; } set { if (this.Ddjs != value) { this.Ddjs = value; OnPropertyChanged("ddjs"); } } } public string Ddjs;

public decimal dj { get { return this.Dj; } set { if (this.Dj != value) { this.Dj = value; OnPropertyChanged("dj"); } } } public decimal Dj;

public decimal hydj { get { return this.Hydj; } set { if (this.Hydj != value) { this.Hydj = value; OnPropertyChanged("hydj"); } } } public decimal Hydj;

public string lastdate { get { return this.Lastdate; } set { if (this.Lastdate != value) { this.Lastdate = value; OnPropertyChanged("lastdate"); } } } public string Lastdate;

#region INotifyPropertyChanged Members

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

private void OnPropertyChanged(string propertyName)

{

System.ComponentModel.PropertyChangedEventHandler handler = this.PropertyChanged;

if (handler != null)

{

handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));

}

#endregion

public override void OnLoad()

{

base.OnLoad();

}

public override void Deallocate()

{

base.Deallocate();

}

}

3: 创建数据库

public static Database db;

应用程序开启时打开数据库

Storage instanse = StorageFactory.Instance.CreateStorage();             //初始化数据库文件为1M

instanse.SetProperty("perst.file.extension.quantum", 512 * 1024);             //数据库大小不够时,每次增加512K

instanse.SetProperty("perst.extension.quantum", 512 * 1024);

instanse.Open("demo.dbf");

db = new Database(instanse);

应用程序关闭时关闭数据库连接

db.Storage.Close();

4 常用的方法有:

//检索:

List<PrintData_H> pp = App.db.Select<PrintData_H>(p => (p.bigAccountDataId == y.bigAccountDataId)).ToList();
List<City> list = App.db.Select<City>("order by CityNum").ToList();

// 新增
 App.db.AddRecord(x);
 App.db.Storage.Commit();

// 修改
x.Store();
 App.db.UpdateFullTextIndex(x);

// 删除
 App.db.DeleteRecord(x);
 App.db.Storage.Commit();

Perst常用命令的更多相关文章

  1. Linux 常用命令(持续补充)

    常用命令: command &:将进程放在后台执行 ctrl + z:暂停当前进程 并放入后台 jobs:查看当前后台任务 bg( %id):将任务转为后台执行 fg( %id):将任务调回前 ...

  2. LVM基本介绍与常用命令

    一.LVM介绍LVM是 Logical Volume Manager(逻辑卷管理)的简写,它是Linux环境下对磁盘分区进行管理的一种机制LVM - 优点:LVM通常用于装备大量磁盘的系统,但它同样适 ...

  3. Linux学习笔记(一):常用命令

    经过统计Linux中能够识别的命令超过3000种,当然常用的命令就远远没有这么多了,按照我的习惯,我把已经学过的Linux常用命令做了以下几个方面的分割: 1.文件处理命令 2.文件搜索命令 3.帮助 ...

  4. git常用命令(持续更新中)

    git常用命令(持续更新中) 本地仓库操作git int                                 初始化本地仓库git add .                       ...

  5. 【原】npm 常用命令详解

    今年上半年在学习gulp的使用,对npm的掌握是必不可少的,经常到npm官网查询文档让我感到不爽,还不如整理了一些常用的命令到自己博客上,于是根据自己的理解简单翻译过来,终于有点输出,想学习npm这块 ...

  6. npm常用命令

    npm常用命令 环境:win7 npm 是什么 NPM(node package manager),通常称为node包管理器.顾名思义,它的主要功能就是管理node包,包括:安装.卸载.更新.查看.搜 ...

  7. Git 常用命令

    一.初始環境配置 git config --global user.name "John Doe"git config --global user.email johndoe@ex ...

  8. linux iptables常用命令之配置生产环境iptables及优化

    在了解iptables的详细原理之前,我们先来看下如何使用iptables,以终为始,有可能会让你对iptables了解更深 所以接下来我们以配置一个生产环境下的iptables为例来讲讲它的常用命令 ...

  9. Linux常用命令(一)

    Linux常用命令 1. pwd查看当前路径(Print Working Directory)    [root@CentOS ~]# pwd/root 2. cd .. 返回上一级 .. 表示上一级 ...

随机推荐

  1. Redis GetTypedClient

    C#操作Redis   未包含GetTypedClient定义 原创,转载请注明出处. VS版本:2015 用NuGet安装了Redis的包 按照百度的各种教程来操作,但是发现网上下载的DEMO可以正 ...

  2. Java 基础之-枚举

      目录(?)[-] 用法一常量 用法二switch 用法三向枚举中添加新方法 用法四覆盖枚举的方法 用法五实现接口 用法六使用接口组织枚举 用法七关于枚举集合的使用   DK1.5引入了新的类型-- ...

  3. Python模块:struct

    各个编程语言都有自己的数据类型,当python需要接受其他语言或者网络传输来交互数据的时候,需要考虑到python的数据类型与其他平台之间交互问题.而python的struct就是解决这个问题的. s ...

  4. Mongodb 服务(windows环境下)因被强制关闭,导致服务不能启动的处理办法

    环境:windows 8操作系统下 前置条件:因操作系统原因,没有先停止mongodb服务,直接重启操作系统. 导致结果:mongodb服务无法启动,弹出框报错. Windows 无法启动MongoD ...

  5. CSS自动换行

    style="word-break:break-all;word-wrap:break-word;"

  6. 深入理解Java虚拟机(二)、Java对象的创建,内存布局和访问定位

    对象的创建: Object obj = new Object(); 常量池中是否有Ljava.lang.Object

  7. ubuntu命令大全

    一.文件/文件夹管理 ls 列出当前目录文件(不包括隐含文件) ls -a 列出当前目录文件(包括隐含文件) ls -l 列出当前目录下文件的详细信息 cd .. 回当前目录的上一级目录 cd - 回 ...

  8. DbProviderFactory .net数据库工厂模式

    http://kb.cnblogs.com/page/72789/  工厂模式 http://www.cnblogs.com/Ruiky/archive/2012/04/19/2456784.html ...

  9. Qt 如何判断文件是不是一个目录

    做个文件管理系统的时候碰到的question,下面来讲解下方法,因为在网上都没找到,就只能翻官方文档相关信息结果找到isFile(),isDir(); 因为是文件管理系统,那么肯定现先获取到它的路径以 ...

  10. bash快捷建

    bash快捷建 ctrl键组合ctrl+a:光标移到行首.ctrl+b:光标左移一个字母ctrl+c:杀死当前进程.ctrl+d:退出当前 Shell.ctrl+e:光标移到行尾.ctrl+h:删除光 ...