MOON.ORM 3.6发布下载 及帮助文档
代码功能演示
using System;
using System.Collections.Generic;
using Moon.Orm;
using MoonDB;
namespace r
{
class Program
{
public static void Main(string[] args)
{
//数据添加
PersonSet person=new PersonSet();
person.Age=133;
person.AgePeriod=1;
person.IsBeiJing=true;
person.Sex=true;
person.UserName="秦";
DBFactory.Add(person);
Console.WriteLine("新的数据唯一识别标志:"+person.GetOnlyMark());
//另类数据添加
person.Set(PersonSetTable.UserName,"另类");
person.Set(PersonSetTable.Age,12);
person.Set(PersonSetTable.AgePeriod,11);
person.Set(PersonSetTable.IsBeiJing,false);
person.Set(PersonSetTable.Sex,true);
DBFactory.Add(person);
Console.WriteLine("新的数据11唯一识别标志:"+person.GetOnlyMark());
//数据删除
long ret= DBFactory.DeleteWhen(PersonSetTable.IsBeiJing.Equal(1).And(PersonSetTable.Age.BiggerThan(12)));
Console.WriteLine("被删除的条数:"+ret);
//改数据
person.UserName="另类修改后";
person.SetOnlyMark(PersonSetTable.UserName.Equal("另类"));
DBFactory.Update(person);
//查询
PersonSet p=DBFactory.GetEntity<PersonSet>(
PersonSetTable.UserName.Equal("另类修改后"));
Console.WriteLine(p.Age);
//查询一个字段
int age=DBFactory.GetOneField<int>(PersonSetTable.Age, PersonSetTable.ID.Equal(5));
Console.WriteLine(age);
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
using System.Collections.Generic;
using Moon.Orm;
using MoonDB;
namespace r
{
class Program
{
public static void Main(string[] args)
{
//数据添加
PersonSet person=new PersonSet();
person.Age=133;
person.AgePeriod=1;
person.IsBeiJing=true;
person.Sex=true;
person.UserName="秦";
DBFactory.Add(person);
Console.WriteLine("新的数据唯一识别标志:"+person.GetOnlyMark());
//另类数据添加
person.Set(PersonSetTable.UserName,"另类");
person.Set(PersonSetTable.Age,12);
person.Set(PersonSetTable.AgePeriod,11);
person.Set(PersonSetTable.IsBeiJing,false);
person.Set(PersonSetTable.Sex,true);
DBFactory.Add(person);
Console.WriteLine("新的数据11唯一识别标志:"+person.GetOnlyMark());
//数据删除
long ret= DBFactory.DeleteWhen(PersonSetTable.IsBeiJing.Equal(1).And(PersonSetTable.Age.BiggerThan(12)));
Console.WriteLine("被删除的条数:"+ret);
//改数据
person.UserName="另类修改后";
person.SetOnlyMark(PersonSetTable.UserName.Equal("另类"));
DBFactory.Update(person);
//查询
PersonSet p=DBFactory.GetEntity<PersonSet>(
PersonSetTable.UserName.Equal("另类修改后"));
Console.WriteLine(p.Age);
//查询一个字段
int age=DBFactory.GetOneField<int>(PersonSetTable.Age, PersonSetTable.ID.Equal(5));
Console.WriteLine(age);
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
少侠,我看你气度不凡天赋异禀,骨骼精奇,这么帅,来了就帮推荐一把吧
我的最近更新