Currently you can't use multidimensional array fields in a server without persistent classes setup.
01/* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com */ 02
namespace Db4objects.Db4odoc.NoClasses.Client 03
{ 04
05
public class RecordBook { 06
private string[,] _notes; 07
private int _recordCounter; 08
09
10
public RecordBook() 11
{ 12
_notes = new string[20,3]; 13
_recordCounter = 0; 14
} 15
16
public void AddRecord(string period, string pilotName, string note) 17
{ 18
_notes[_recordCounter, 0] = period; 19
_notes[_recordCounter, 1] = pilotName; 20
_notes[_recordCounter, 2] = note; 21
_recordCounter ++; 22
} 23
24
public override string ToString() 25
{ 26
string temp; 27
temp = "Record book: \n"; 28
for (int i=0; i<_recordCounter;i++ ){ 29
temp = temp + _notes[i,0] + "/" + _notes[i,1] + "/" + _notes[i,2] + "\n"; 30
} 31
return temp; 32
} 33
} 34
}
01private static void SaveMultiArray() 02
{ 03
Console.WriteLine("Testing saving an object with multidimentional array field"); 04
IObjectContainer oc = Db4oFactory.OpenClient("localhost", 0xdb40, "db4o", "db4o"); 05
try 06
{ 07
RecordBook recordBook = new RecordBook(); 08
recordBook.AddRecord("September 2006", "Michael Schumacher", "last race"); 09
recordBook.AddRecord("September 2006", "Kimi Raikkonen", "no notes"); 10
oc.Set(recordBook); 11
} 12
finally 13
{ 14
oc.Close(); 15
} 16
}
01private static void GetMultiArray() 02
{ 03
Console.WriteLine("Testing retrieving an object with multidimentional array field"); 04
IObjectContainer oc = Db4oFactory.OpenClient("localhost", 0xdb40, "db4o", "db4o"); 05
try 06
{ 07
IObjectSet result = oc.Get(new RecordBook()); 08
ListResult(result); 09
} 10
finally 11
{ 12
oc.Close(); 13
} 14
}
01' Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com 02
Namespace Db4objects.Db4odoc.NoClasses.Client 03
04
Public Class RecordBook 05
Private _notes As String(,) 06
Private _recordCounter As Integer 07
08
Public Sub New() 09
_notes = New String(20, 3) {} 10
_recordCounter = 0 11
End Sub 12
13
Public Sub AddRecord(ByVal period As String, ByVal pilotName As String, ByVal note As String) 14
_notes(_recordCounter, 0) = period 15
_notes(_recordCounter, 1) = pilotName 16
_notes(_recordCounter, 2) = note 17
System.Math.Min(System.Threading.Interlocked.Increment(_recordCounter), _recordCounter - 1) 18
End Sub 19
20
Public Overloads Overrides Function ToString() As String 21
Dim temp As String 22
temp = "Record book: " & Microsoft.VisualBasic.Chr(10) & "" 23
Dim i As Integer = 0 24
While i < _recordCounter 25
temp = temp + _notes(i, 0) + "/" + _notes(i, 1) + "/" + _notes(i, 2) + "" & Microsoft.VisualBasic.Chr(10) & "" 26
System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1) 27
End While 28
Return temp 29
End Function 30
End Class 31
End Namespace
01Private Shared Sub SaveMultiArray() 02
Console.WriteLine("Testing saving an object with multidimentional array field") 03
Dim oc As IObjectContainer = Db4oFactory.OpenClient("localhost", &HDB40, "db4o", "db4o") 04
Try 05
Dim recordBook As RecordBook = New RecordBook 06
recordBook.AddRecord("September 2006", "Michael Schumacher", "last race") 07
recordBook.AddRecord("September 2006", "Kimi Raikkonen", "no notes") 08
oc.Set(recordBook) 09
Finally 10
oc.Close() 11
End Try 12
End Sub
01Private Shared Sub GetMultiArray() 02
Console.WriteLine("Testing retrieving an object with multidimentional array field") 03
Dim oc As IObjectContainer = Db4oFactory.OpenClient("localhost", &HDB40, "db4o", "db4o") 04
Try 05
Dim result As IObjectSet = oc.Get(New RecordBook) 06
ListResult(result) 07
Finally 08
oc.Close() 09
End Try 10
End Sub