轮子来袭 vJine.Core Orm 之 01_快速体验
vJine.Core 是.Net环境下C#类库,在其包含的众多功能中ORM功能尤为突出,现简介如下。
一、支持的数据库:
SQLite, MySQL, MS SQL, Oracle。
二、使用方法:
0.添加引用:
库文件vJine.Core.dll,
using vJine.Core;
using vJine.Core.ORM;
1.定义类:
using System;
using System.Collections.Generic;
using System.Text;
using vJine.Core.Base;
using vJine.Core.IO;
using vJine.Core.ORM; namespace vJineCore_QuickStart.BML { public class My_Model : ItemBase /*不是必须继承*/ {
public My_Model() {
this.ID = Guid.NewGuid().ToString("N");
} public partial class _ {
public static readonly Property<My_Model, string> ID = new Property<My_Model, string>("ID");
}
string _ID;
[Key(IsPrimary=true)] //指定主键
public string ID {
get {
return this._ID;
}
set {
if (value != this._ID) {
this._ID = value;
this.NotifyPropertyChanged("ID");
}
}
} bool _IsActive;
public bool IsActive {
get {
return this._IsActive;
}
set {
if (value != this._IsActive) {
this._IsActive = value;
this.NotifyPropertyChanged("IsActive");
}
}
} public enum Status:byte {
Unknown = ,
Ready = ,
Running = ,
Done =
} Status _MyStatus;
public partial class _ {
public static readonly Property<My_Model, Status> MyStatus = new Property<My_Model, Status>("MyStatus");
}
public Status MyStatus { //支持枚举类型
get {
return this._MyStatus;
}
set {
if (value != this._MyStatus) {
this._MyStatus = value;
this.NotifyPropertyChanged("MyStatus");
}
}
} public partial class _ {
public static readonly Property<My_Model, int> Qty = new Property<My_Model, int>("Qty");
}
int _Qty;
public int Qty {
get {
return this._Qty;
}
set {
if (value != this._Qty) {
this._Qty = value;
this.NotifyPropertyChanged("Qty");
}
}
} DateTime _Stamp;
public DateTime Stamp {
get {
return this._Stamp;
}
set {
if (value != this._Stamp) {
this._Stamp = value;
this.NotifyPropertyChanged("Stamp");
}
}
}
}
}
2.配置连接:
<connectionStrings>
<add name="Default" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=【数据库名称】;Integrated Security=True"/>
</connectionStrings>
注:请将【数据库名称】改为你本地对应的数据库名。
3.新建实例:
DataManager dm = new DataManager(); //引用Default配置
DataManager dm = new DataManager("specific_name"); //引用指定配置
4.创建数据表:
//Create Table
dm.Create<My_Model>();
5.增删改查:
My_Model new_data = new My_Model() {
Qty = , IsActive = false, MyStatus = My_Model.Status.Ready
};
new_data.Stamp = dm.Now;
dm.I<My_Model>(new_data);
dm.D<BML.My_Model>(BML.My_Model._.ID == "xxx");
dm.U<BML.My_Model>(My_Model._.Qty.EQ(My_Model._.Qty + 1) & My_Model._.MyStatus.EQ(My_Model.Status.Running), My_Model._.MyStatus == My_Model.Status.Ready);
List<My_Model> container = new List<My_Model>();
//先定义一个实现IList<>接口的对象容器,查询结果将累加填充
dm.Q<My_Model>(container, My_Model._.ID.Like("ABC%") & My_Model._.Qty > );
三、附件:
四、附注:
1、默认连接配置为 MS SQL Server,未保证测试顺利进行,请优先使用MS SQL Server, connectionString请依据您服务器的实际情况更改。
2、本篇仅作为功能体验的引导文章,后续将陆续推出使用细则、架构设计等相关内容。
3、vJine.Core将已开源模式提供,可用免费于私人和商业用途,但作者本人不反使用者通过以下方式给以赞同(顶贴、点赞、推荐)。
4、关于性能:性能方面个人暂无比较,如有热衷于这方面的朋友帮忙做个测试,将不胜感激。
5、vJine.Core的目标是:简洁、高效、轻量级、非侵入。
轮子来袭 vJine.Core Orm 之 01_快速体验的更多相关文章
- 轮子来袭 vJine.Core Orm 之 03_架构分析
1.vJine.Core ORM 架构: 如上图所示,vJine.Core ORM的特点如下: 所有操作均以DataManager为核心: DataManager业务部分的增删改查操作依赖于Class ...
- 轮子来袭 vJine.Core Orm 之 04_使用进阶
1.配置文件: 框架默认情况下支持"connectionStrings"的配置方式,如<轮子来袭 vJine.Core Orm 之 01_快速入门>所述: 框架的进阶设 ...
- 轮子来袭 vJine.Core Orm 之 02_代码生成
1.下载并安装动软代码生成器: 2.下载vJine.Core.Orm模板: 3.解压模本文件并复制到如下的动软代码生成器模板目录: 4.打开动软代码生成器会看到模板已识别加载: 5.选择模板代码批量生 ...
- 轮子来袭 vJine.Core 之 AppConfig<T>
1.引用vJine.Core; 2.定义配置类; using System; using System.Collections.Generic; using System.Text; using Sy ...
- .NET Core前后端分离快速开发框架(Core.3.0+AntdVue)
.NET Core前后端分离快速开发框架(Core.3.0+AntdVue) 目录 引言 简介 环境搭建 开发环境要求 基础数据库构建 数据库设计规范 运行 使用教程 全局配置 快速开发 管理员登录 ...
- [转].NET Core前后端分离快速开发框架(Core.3.0+AntdVue)
[转].NET Core前后端分离快速开发框架(Core.3.0+AntdVue) 目录 引言 简介 环境搭建 开发环境要求 基础数据库构建 数据库设计规范 运行 使用教程 全局配置 快速开发 管理员 ...
- vJine.Core 0.3.0.49 正式发布
nuget: https://www.nuget.org/packages/vJine.Core/ oschina: http://git.oschina.net/vjine/vJine.Core/a ...
- .Net Core ORM选择之路,哪个才适合你 通用查询类封装之Mongodb篇 Snowflake(雪花算法)的JavaScript实现 【开发记录】如何在B/S项目中使用中国天气的实时天气功能 【开发记录】微信小游戏开发入门——俄罗斯方块
.Net Core ORM选择之路,哪个才适合你 因为老板的一句话公司项目需要迁移到.Net Core ,但是以前同事用的ORM不支持.Net Core 开发过程也遇到了各种坑,插入条数多了也特别 ...
- .Net Core 3.0 IdentityServer4 快速入门
.Net Core 3.0 IdentityServer4 快速入门 一.简介 IdentityServer4是用于ASP.NET Core的OpenID Connect和OAuth 2.0框架. 将 ...
随机推荐
- iOS开发Block的使用
Block 是从 iOS4引入的,在日常开发中,会经常用到Block.特别是在多线程中,Block的用处更广泛.而且,Block不仅可以接收参数,其本身也可以作为参数,因此,Block的功能非常强大. ...
- 剑指OFFER之从二叉搜索树的后序遍历序列(九度OJ1367)
题目描述: 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果.如果是则输出Yes,否则输出No.假设输入的数组的任意两个数字都互不相同. 输入: 每个测试案例包括2行: 第一行为1个整数 ...
- AS问题解决系列1—Unable to execute DX错误
http://my.oschina.net/1pei/blog/478968 摘要 在将一个开源Android代码import到Android Studio 1.2.2中时,解决了编译期间出现的“Un ...
- [AngularJS] angular-schema-form -- 1
Check out on gitHub, see the example on Demo page, see the document, extension. Mainly, there are th ...
- 返回类型和return语句
return语句终止当前正在执行的函数并将控制权返回到调用该函数的地方.return语句有两种形式: return; return expression; 无返回值函数 没有返回值的return语句只 ...
- js hash字符串转成json
var a='account.type=1&account.id=&account.dependFlag=0&account.card.companyId=1&acco ...
- PAT 1005
1005. Spell It Right (20) Given a non-negative integer N, your task is to compute the sum of all the ...
- Making the impossible: 3 nodes intercontinental replication--转载
原文:http://www.percona.com/blog/2012/01/11/making-the-impossible-3-nodes-intercontinental-replication ...
- 20 Best Drag and Drop jQuery Plugins--reference
reference from:http://dizyne.net/20-best-drag-drop-jquery-plugins/ jQuery has done a great job repla ...
- CLI Console
CLI Console New to 3.0 is a command line utility aptly named Nova located in the root. It currently ...