Siaqodb 2.0 released

We are excited to announce that Siaqodb 2.0 was released today. The main features added are:

  • POCO support- now a storable class is not mandatory anymore to implement ISqoDataObject or to inherit from SqoDataObject
  • Indexes support added – now you can index by a property/field so queries are much faster if index is involved.
  • Attributes like Index, UniqueConstraint, MaxLength, Ignore can be used also on automatic properties
  • Added new methods on Siaqodb class like:DeleteObjectBy(…) or LoadObjectByOID(…)
  • Support for just released WP7 developer tools BETA

Let’s detail a bit about those features added and reasons…

POCO support:

Since start-up of project many developers found that inheriting from base class or even implement only the ISqoDataObject interface is a limitation of Siaqodb and main reason is most of the time from Architectural point of view. There are many pro/cons about POCO, here is an example, also EF4 support now POCO after feedback from developers and interesting feedback was given  here
and seems MS really took in consideration since EF4 support it, take a look at new Scott Guthrie’s blog post

Is out of scope to detail more about pro/cons of POCO and in above links you can find very interesting arguments, important thing is that Siaqodb provide freedom to developer to use POCO or not.

So as an example following Type can be stored on Siaqodb:

public class MyPOCO
{
       public int OID { get; set; }
       public int MyInt{ get; set; }
       public string MyStr { get; set; }
       public Guid UId{ get; set; }
}

There is still a requirement for a storable class: every storable classe should define OID property, and on Silverlight is needed to declare 2 extra methods because of Silverlight reflection limitation, so on Silverlight POCO class definition would look like:

public class MyPOCO
{
       public int OID { get; set; }
       public int MyInt{ get; set; }
       public string MyStr { get; set; }
       public Guid UId{ get; set; }
       public object GetValue(System.Reflection.FieldInfo field)
        {
            return field.GetValue(this);
        }
        public void SetValue(System.Reflection.FieldInfo field, object value)
        {
            field.SetValue(this, value);
        }

}

But what about attributes like Ignore,UniqueConstraint, etc? if I decorate properties of my entities with those attributes then we violate POCO definition. Solution is to use SiaqodbConfigurator, so for example if you want to add an Index instead of putting
an Attribute Index on property you add index by SiaqodbConfigurator method like:

SiaqodbConfigurator.AddIndex("UId", typeof(MyPOCO));
SiaqodbConfigurator.AddUniqueConstraint("UId", typeof(MyPOCO));

 Siaqodb sq = new Siaqodb(objPath);
 Guid id=Guid.NewGuid();
 sq.StoreObject(new MyPOCO(){MyInt=3,UId=id});

 var q = from MyPOCO myobj in siaqodb
             where myobj.UId == id //index is used->fast query
             select myobj;

INDEX support

Indexes are implemented using AVL trees ;
adding an index to a field will speed up your queries that involve that field, example:

 class ClassWithIndex
    {
        public int OID { get; set; }

        [Index]
        public int MyID { get; set; }

        public string Name { get; set; }
    }

.....

            Siaqodb siaqodb = new Siaqodb(Program.siaoqodbPath);
            siaqodb.DropType<ClassWithIndex>();

            for (int i = 0; i < 100000; i++)
            {
                ClassWithIndex myobj = new ClassWithIndex() ;
                myobj.MyID=i%10;
                myobj.Name = "MyTest" + i.ToString() ;

                siaqodb.StoreObject(myobj);
            }
            DateTime start = DateTime.Now;
            var q = from ClassWithIndex myobj in siaqodb
                      where myobj.MyID == 8 //here will be used index lookup
                      select myobj;
            int k = 0;
            foreach (ClassWithIndex obj in q)
            { 
                //do something with object
                k++;
            }
            string timeElapsed = (DateTime.Now - start).ToString();

            Console.WriteLine("Time elapsed to load:" + k.ToString() + "objects from 100.000 stored objects  filtered by index:" + timeElapsed);

Index are also useful and is really recommended if is used a UniqueConstraint to a field then use also Index to that field, because on Insert/Update lookup for uniqueness, index will be used so faster insert/update.

Support for just released WP7 dev. tools BETA

Just a few days ago Microsoft released Windows Phone Developer Tools Beta
There are some big changes and Siaqodb now fully support WP7 Beta, example is also compiled under BETA and not anymore on CTP version of WP7 dev. tools.

Important for existing users: upgrade can be made on the fly, Siaqodb 2.0 is fully compatible with older versions.

So to see Siaqodb 2.0 in action, download latest setup and run Examples.

Comments

  1. [...] Siaqodb v2.0 released. Siaqodb is object database for .NET, Mono and Silverlight also run on WP7 platform. New features added: -POCO support -Indexes an more: Siaqodb 2.0 released | siaqodb [...]

    Posted by Siaqodb 2.0 released - dBforums

    Link | July 20th, 2010 at 5:09 am

  2. I try Siaqodb v2.0 in VS2010(.Net4)

    When I add an ADO.NET Entity Data Model at Silverlight4 RIA project, I can not find Siaqodb in Data Provider.

    Will Siaqodb full support EF4?
    If no, maybe EffiPro is a better choice.

    Posted by gattaca

    Link | September 6th, 2010 at 7:44 pm

  3. Siaqodb is object database, EF is a ORM mapper and map your tables from a relational database to objects. Siaqodb not need a ORM since save objects directly as they are, is not needed EF overhead because make no sense to map objects to objects so just an extra layer… Silverlight RIA services work with database on server side, Siaqodb for Silverlight is client side database, big diff. With SL RIA you can use all server-side databases like MS SQLServer.

    Posted by siaqodb_admin

    Link | September 7th, 2010 at 4:57 am

Leave Your Comment