再看复杂的
View Code
var volleyball = new Sport(volleyball)
var player = new Player(julia DateTimeNow volleyball)
var player = new Player(magdalena DateTimeNow volleyball)
var player = new Player(jacek DateTimeNow volleyball)
var player = new Player(michal DateTimeNow volleyball)
var team = new Team(Krakow)
var team = new Team(Skawina)
teamAddPlayer(player)
teamAddPlayer(player)
teamAddPlayer(player)
teamAddPlayer(player)
var game = new Game(DateTimeNow volleyball team team)
using (var odb = OdbFactoryOpen(TutorialDbMinName))
odbStore(game)
再看看几个简单的查询例子
最简单的注释就免了都比较简单
using (var odb = OdbFactoryOpen(TutorialDbMinName))
{
var query = odbQuery<Player>()
queryDescend(Name)Constrain(julia)Equal()
var players = queryExecute<Player>()
ConsoleWriteLine(\nStep (Soda) Players with name julia)
foreach (var player in players)
ConsoleWriteLine(\t{} player)
AssertThat(players HasCountEqualTo())
}
看看这种LINQ的查询方式
using (var odb = OdbFactoryOpen(TutorialDbMinName))
{
var players = from player in odbAsQueryable<Player>()
where playerNameEquals(julia)
select player;
ConsoleWriteLine(\nStep (Linq) Players with name julia)
foreach (var player in players)
ConsoleWriteLine(\t{} player)
AssertThat(playersCount() IsEqualTo())
}
简单的例子就写这么多吧实际的还有很多灵活的操作比如比较查询还对表直接的关系等等如果有兴趣适合你可以看后面的资源链接
NDatabase资源
开源网址
https://ndatabasecodeplexcom/
http://ndatabasewixcom/home#!overview/ch
http://ndatabasenet/
[] [] []