Over the past few months, Rodrigo and I have been working a lot in
the area of our Java to C# converter. The upcoming 6.0 version was the
occasion for us to introduce some big changes in db4o, just like we did
in the past when we've moved from camelCase casing to PascalCase casing
for the methods.
We've worked a lot on dealing with .net
conventions, to get a more than ever native db4o for .net and Mono. Let
me show you, in one short example, most of the changes:
using Db4objects.Db4o;
using Db4objects.Db4o.Query;
class Test
{
public static void Main()
{
using (IObjectContainer store = Db4oFactory.OpenFile("test.yap"))
{
IQuery q = store.Query();
q.Constrain(typeof(Person));
foreach (Person p in q.Execute())
{
Console.WriteLine (p);
}
}
}
}
The more obvious changes are in the namespaces names. Instead of having a Javaish com.db4o, we now have a nice Db4objects.Db4o namespace. Another big change is that accordingly to the framework conventions, all our interfaces's name start with an "I" (note the IQuery and the IObjectSet). Also, for all of you that are using a case-insensitive language, like VB.NET, we renamed the Db4o class, that used to clash with the namespace, to Db4oFactory.
We also have some nice changes under the hood, like using the native .net type system directly, instead of using our old j4o layer on top of it. We are also mapping every possible type to its .net equivalent. In the field of collections that means that our types now implement System.Collections.IEnumerator or System.Collections.IEnumerable instead of our own types. That's really nice.
Of course, we will ship a legacy version of db4o 6.0, which still uses the old conventions for our existing users. But I'm sure that they won't resist long to the strong desire of using this new API. This legacy assembly will keep it's old name: db4o.dll, while the new one is named
Db4objects.Db4o.dll. Hence, no confusion is possible.
If you want to give a try right now, you can checkout from our
SVN repository the new db4o.net module. You should be able to build the projects you're interested in by just picking the good solution file for your Visual Studio installation. Also, you may notice that we are now using a brand new Db4oUnit test framework that is shared with the Java version. Thus we can write a test in Java and get it running on .net automatically using our converter. So if you're in the mood to write C# unit tests (you can find plenty of them in db4o.net/Db4objects.Db4o.Tests), it will be very easy to integrate them in our regression test suite.
I'm really happy with the new conventions, you can feel the love when you type "using Db4objects.Db4o;". Feel the love!