Eloquera DB 2.8 released

by Eloquera Team 22. July 2010 12:00

Here is a new release of the Eloquera DB. In the version 2.8 we have done some fixes and improvements – the list is on the download page.

Besides, now in the database creation scripts you can add types that you do not wish to have in the database, e.g., debug or runtime only objects. For example, you cannot restore Thread objects from the database, even though you can store them. The functionality can be used in a pretty simple way:


db.RegisterType(typeof(Book));
db.TypeRules.IgnoreType(typeof(DebugBook)).
                    IgnoreType(typeof(DebugAuthor)).
                    IgnoreType(typeof(InputServer));

That will add a rule to the database to ignore all objects, fields and properties of the specified types and of their descendant types.

Any newly created database has a list of types automatically added to the ignored type list:

  • System.Runtime.ConstrainedExecution.CriticalFinalizerObject
  • System.Type
  • System.Reflection.Assembly
  • System.AppDomain
  • System.ActivationContext
  • System.Exception
  • System.AppDomainManager
  • System.IAppDomainSetup
  • System.ApplicationId
  • System.ApplicationIdentity
  • System.Attribute
  • System.Threading.WaitHandle
  • System.Runtime.InteropServices._AssemblyName
  • System.Reflection.Binder
  • System.IntPtr
  • System.Signature
  • System.WeakReference
  • System.Threading.Timer
  • System.Threading.TimerBase
  • System.Threading.SynchronizationContext
  • System.Threading.Overlapped
  • System.IntPtr
  • System.Windows.Threading.Dispatcher
  • System.Windows.DependencyProperty
  • System.Threading.CompressedStack
  • System.Threading.Monitor
  • System.IO.Stream
  • System.Runtime.Serialization.SerializationInfo
  • MS.Utility.FrugalListBase<>
  • MS.Utility.FrugalObjectList<>
  • System.Windows.Media.UniqueEventHelper<>
  • System.Windows.Media.UniqueEventHelper
  • System.Windows.Media.ColorContext

  • We hope this feature will help avoiding problems with types that do not carry any useful information when persisted.

    Happy programming!

    Tags: , ,

    Eloquera DB in the desktop mode

    by Eloquera Team 2. June 2010 15:13

    We have had many questions whether the Eloquera DB has a capability to work as an embedded database. The short answer is yes.

    And here are some details about what we call the desktop mode of the Eloquera DB.

    Actually, from the program point of view there is no difference between the client/server and the desktop mode. The desktop mode doesn’t need a server or the Eloquera DB service running. Your application can be distributed with a few Eloquera DB assemblies and enjoy a full functionality of the Eloquera DB without installing one (just don’t forget to drop us an email if you are going to do so!)

    To run the Eloquera DB in the desktop mode use (local) as a server name, like this:

    DB db = new DB("server=(local);password=pwd;options=none;");

    The database will work in a single user mode, and, therefore, security is not supported in the desktop mode.We have been asked if 2 or more users can share the same database; of course, and that is called the client/server mode.

    After the installation the Eloquera Server service starts automatically. Make sure that for the desktop mode you have stopped the service. Otherwise, you may get exceptions about (local) being a wrong server name (and that sounds pretty reasonable.)

    There is another option to start the Eloquera database in the desktop mode.

    1) Copy the following assemblies and a configuration file from the %ProgramFiles%\Eloquera folder into a project folder:

    Eloquera.config
    Eloquera.Client.dll
    Eloquera.Common.dll
    Eloquera.Server.exe

    You can copy the reference files into a separate folder for your convenience.

    2) Uninstall the Eloquera DB (sounds awful, but we have copies all files we will need)

    3) Add Eloquera.config into your project via “Add an existing item…”, and set its "Copy to Output Directory" property to "Copy Always".

    4) Add the project references to these files:

    Eloquera.Client.dll
    Eloquera.Server.exe

    5) Rebuild your project and check that Debug\ and/or Release\ folders contain the following files along with your application:

    Eloquera.config
    Eloquera.Client.dll
    Eloquera.Common.dll
    Eloquera.Server.exe

    6) You may change a physical path to the database files in the Eloquera.config file by setting DatabasePath value:

    DatabasePath="c:\dev\db"

    And now you can kiss the bride run your application.

    Happy programming!

    Tags: , ,

    Updates on upcoming releases 2.7.0 and 3.0.0

    by Eloquera Team 31. May 2010 14:32

    Updates on upcoming releases 2.7.0 and 3.0.0
    There were some updates on releases and planned features.

    2.7.0 (due 3 June)

    From this version we will start to introduce Enterprise version of the database.

    Free version

    - Starting from 2.7.0 Eloquera starts supporting in-memory database.
    db = new DB("server=(local);password=;options=inmemory;");
    A preview version of in-memory database will be available. In-memory database size will be limited to 1GB.
    In-memory database is useful for the users with a high speed data processing, within embedded environments and for volatile data storing e.g. monitored data
    - Added full support to store fields of struct type
    - Added full support for arrays and DateTime in LINQ
    - Added LINQ support to query objects using UID
    - Fixes for CONTAINS ALL and CONTAINS ANY for arrays

    Enterprise version (free for our gold and platinum customers)

    - In-memory database size is unlimited

    3.0.0 (due in 3 -4 weeks time)

    Free version

    - RegisterType to allow types definitions update.
    - EF support

    Enterprise version (free for our gold and platinum customers)

    - Runtime update capability to update type definition in the database while keeping database online.
    - Object store and/or update notification mechanism.

    Tags: , , ,

    New release coming soon

    by Eloquera Team 18. May 2010 04:46

    An upcoming release 2.7.0 will bring a bunch of new features

  • RegisterType to allow developers update type definitions in the database

  • The following API will be available

    RegisterType(Type type); 
    RegisterType(Type type, TypeDefinitions typeDefs)

    TypeDefinitions will have available AddIndex, RemoveIndex, IgnoreMember, IgnoreType, RenameMember Here is a sample how update type will work

    // Sample syntax for creating or updating an existing type. 
    db.RegisterType(typeof(Book), db.TypeRules.IgnoreMember("Publisher").AddIndex("Title").AddIndex("Author"));

    The code above will update Book type in the database with a new Book definition. Will add [Ignore] to the property Publisher and will add indexes for properties Title and Author. If the type Book is not available in the database, it will be added into the database with the specified type definitions.


  • SKIP support in SQL

  • Example of SKIP

    SELECT SKIP 10 TOP 20 Book WHERE Price >10 ORDER BY Title


  • SKIP support in LINQ


  • Multidimensional and jagged arrays support in LINQ



  • We will also introduce an Enterprise version of the database with extra functionality.
    Enterprise version of the database will be available for free to our Gold and Platinum customers ( Support )
    A new functionality will include:

  • Runtime update type capability to update type definition in the database while keeping database online

  • Object store and/or update notification mechanism

  • Tags: , , ,

    Database installation script

    by Eloquera Team 9. December 2009 00:16

    This post is the beginning of the series about developing applications using Eloquera database. We are going to cover various topics: how to create databases, what is the best way to write applications with Eloquera, both for desktop and web applications.

    We are not focussing only on the database part of the software, but will demonstrate how Eloquera database makes it easy to design and develop applications, even if the code related to data access is encapsulated into separate logical modules.

    There is a simple application that we are going to develop, called Messenger. I have done the basic things, but it is not complete yet.

    You can download the source code for the Messenger application using this link. It is a simple console application allowing ‘users’ to send messages to each other.

    The application is written in C# using Visual Studio 2008, and requires .NET Framework 3.5. Here you can download Eloquera database (version 2.5 beta) , which we have used to create the application. As the database is in the beta stage, the documentation is not completely ready, but I hope the examples in the Messenger app will be extremely easy to understand, and quite self-descriptive.

    All right, let’s start now.

    Messenger application – database installation script


    First, let’s get the app running on your machine.

    Let’s run a database script. That is a simple console application called DbInstall, and included into Messenger solution.

    Eloquera database can easily create databases and add types in the main application. Why do we need any database script in this case?

    There are many reasons for that, e.g., you can run queries without prior checking if the type is present in the database (if you run the query against the type absent in the database, you will get an exception). The most important thing is that in the future versions of Eloquera only database administrators will be able to create databases and register types, while other authenticated users will be able to add, modify and query data only.

    Registering types


    What is the database script for Eloquera DB?

    Just a few lines like this:

       1:  // Now we can create the database. 
       2:    db.CreateDatabase(MessengerDbName); 
       3:    db.OpenDatabase(MessengerDbName); 
       4:   
       5:    // And register all the types. 
       6:    db.RegisterType(typeof(Eloquera.Messenger.Objects.User)); 
       7:    db.RegisterType(typeof(Eloquera.Messenger.Objects.Message)); 
       8:    db.RegisterType(typeof(Eloquera.Messenger.Objects.Subscription));

    The code sample above creates a database, opens it, registers the types you are going to use, and that’s typical database script.

    Registering types is a good thing, because you don’t have to worry about getting exceptions when running queries against such types anymore.

    Adding data


    The installation script in Messenger application does more than that, actually. The code below adds some sample data into the newly created database as well.

       1:  // Add sample users 
       2:    var userSam = new Eloquera.Messenger.Objects.User() { Name = "Sam"}; 
       3:    var userWonka = new Eloquera.Messenger.Objects.User() { Name = "Willy Wonka" }; 
       4:    var userMacquarie = new Eloquera.Messenger.Objects.User() { Name = "Lachlan Macquarie" }; 
       5:    var userCervantes = new Eloquera.Messenger.Objects.User() { Name = "Miguel de Cervantes de Saavedra" };

    Adding data may be helpful for testing, or just to initialise basic objects like an initial user account for a web application, e.g., an account for the administrator with the default password.

    Changing definitions


    Software development is about changing the code all the time. Adding new methods to the classes registered in the database, won’t break anything. But adding new fields and properties (with no [Ignore] attribute) to such classes will result in the EloqueraException exception with the message “Definition in database is different to one on the client”, thrown by Eloquera client. Eloquera database performs integrity checks of your data, and prevents data loss or misinterpretations when class definition changes (EloqueraException is thrown as a result.)

    The database script registers all the types all over again, so, it can delete the old database and create a database with the updated types if your classes have changed during development. The code sample below shows implementation of this procedure:

       1:  // -f flags denotes forcible re-creation of the database. 
       2:      if (args.Length > 0 && args[0] == "-f") 
       3:      { 
       4:          try 
       5:          { 
       6:              db.DeleteDatabase(MessengerDbName, true); 
       7:          } 
       8:          catch (Exception e) 
       9:          { 
      10:              Console.WriteLine("Cannot delete the database file. Check if the file is in use.\nThe error occured:\n{0}", e.Message); 
      11:              return; 
      12:          } 
      13:      }

    The script checks the command-line parameter, and if the -f flag is specified, tries to remove the database.

    This code uses DeleteDatabase() method introduced in Eloquera DB 2.5. The first parameter specifies the name of the database to be deleted. The second parameter forces the database drop all open connections, and then deletes the database.

    Tags: , ,

    Eloquera Database - the web-oriented client/server object database for .NET

    by Eloquera Team 18. August 2009 06:32

    Have you ever thought about having a database that you can write your objects directly, and use SQL for retrieving them back?
    Write objects into database and get them back.

       1:  // Open connection to the server
       2:  using (DB db = new DB("server=localhost;options=none;"))
       3:  {
       4:      // Open the database
       5:      db.OpenDatabase("Cinemas");
       6:   
       7:   
       8:      // Create the object we would like to work with
       9:      Cinema cinema = new Cinema() {
      10:             Location = "Sydney",
      11:             OpenDates = new DateTime[] { new DateTime(2003, 12, 10), new DateTime(2003, 10, 3) }
      12:      };
      13:   
      14:   
      15:      // And here is where the magic begins...
      16:      // Store the object - no conversion required
      17:      db.Store(cinema);
      18:   
      19:   
      20:      // Magic is not finished yet
      21:      // Get an object that matches the criteria
      22:      var movies = db.ExecuteQuery("SELECT Cinema WHERE ALL Movies.Studios.Titles CONTAINS '20th Century Fox'");
      23:   
      24:   
      25:      // Magic still goes on...
      26:      // Creating parameters
      27:      Parameters param = db.CreateParameters();
      28:      param["dt1"] = new DateTime(2006, 10, 1);
      29:      param["dt2"] = new DateTime(2009, 09, 17);
      30:   
      31:   
      32:      // And here we search for the values IN THE ARRAY!
      33:      var result = db.ExecuteQuery("SELECT Cinema WHERE OpenDates BETWEEN @dt1 AND @dt2", param);
      34:   
      35:   
      36:      // And here we do something good with the objects retrieved from the database
      37:      foreach (var cinema in result)
      38:      {
      39:          Console.WriteLine(cinema.ToString());
      40:      }
      41:  }


    This is real code running on Eloquera Database 2.0 (codename Woomera) - the web-oriented client/server object database for .NET. It is already available as a pre-release version on the website Eloquera
    The upcoming version of Eloquera database has some mind-boggling features

    • Storing any .NET object without implementing any interface or inheriting from a specially designed class.
    • Queries based on SQL. Yep, good old SQL. And no SQL database is required.
    • Returns the objects in their native form, as a single object or as an enumeration.
    • Supports arrays in queries. Any arrays - simple, multidimensional, jagged, of simple or complex types. And there is more!
    • Supports JOINs in queries. And even for arrays.
    • Expressions and functions in queries. You can perform JOINs or sort your data on them.
    • Flexible sorting - there are some really useful ones.
    • Regular Expressions are your best friends! Regex support in queries.
    • Indexes. Yep, you can index data for faster access. Both fields and properties.
    • Bulk inserts and updates. You can insert tens of thousands objects in a second.
    • Generic object support. And also in queries.
    • Inheritance support in queries (SELECT ParentClass returns both ParentClass and ChildClass)
    • Queries only upon certain type. (SELECT ONLY ParentClass returns only ParentClass, but not ChildClass)
    • Restoring objects partially (you might need ForumTopic object, but don't need all TopicMessage, linked with it.)
    • Depth for queries.
    • Client/server architecture.
    • Parallel and independent query execution for multiple users.
    • Windows authentication. Specify no user name and log on under your current account.
    • Both Server and client are implemented in 32- and 64-bit architectures.
    • Unique identifier for any object within a database - for stateless environments (hence ASP.NET)
    • Different cultures support in queries (e.g., "where dates BETWEEN['en-US'] @d1 and @d2" - formats will be treated as US English, even with the current UK settings on the machine.
    • Approximate matching with ALMOST keyword.
    • Have you seen an object database with SQL query support? With JOINs? And with arrays?

     So, what do you need to get Eloquera Database 2.0 running on your machine and ready for your command?

     

    First, download and install the Eloquera setup files from the website.  You need to download the server for your platform (32- or 64-bit). The server includes also all client libraries.
    Installation is straightforward, and takes just a few seconds. The setup will install the service called Eloquera Server 2.0.

    Included with the Eloquera server is a folder containing examples in C#. These examples are quite concise but cover various topics on using Eloquera, like JOINs and queries on arrays.

    Secondly, you need to connect to the database in your code. By default, only the members of the Administrators group can access the database server. As Eloquera uses integrated Windows authentication, you can add your own user or a group to the list of the permitted security entities.
    To do that, open the Eloquera Server configuration file (it is usually located at "%ProgramFiles%\Eloquera\Eloquera Server" and it called Eloquera.config) with any suitable text editor (as Notepad).

    Find the Server element, and change the value of the AllowUsers or AllowGroups attribute, adding your user or group to the list. The items in the list are separated by a semicolon. It is advised not to remove Administrators group from the list.
    For development purposes it is good practice to add Users group to the list of allowed groups. After this your <Server> element in the configuration file will like this:

    Server configuration.

       1:     <Server ServerPort="43962" Trace="true" Secure="true" AllowUsers="" AllowGroups="Administrators;Users" />

    Restart the service for the changes to take effect. You can easily perform this task using the command line and running the following commands:
    Restart service

       1:  net stop "Eloquera Server 2.0"
       2:  net start "Eloquera Server 2.0"

    And now Eloquera is ready to run your queries.
    Below I am going to give some brief examples of Eloquera DB queries. We will discuss all the features in the next articles about Eloquera Database. These examples are intended to show how easily you can start working with Eloquera.
    We are going to use these two classes as a base for our demonstration:

    Example classes

       1:  public class School 
       2:  {
       3:     public Location Location { get; set; }
       4:     public string Name { get; set; }
       5:  }
       6:  public class WorkPlace 
       7:  {
       8:     public Location Location { get; set; }
       9:     public string Company { get; set; }
      10:     public string Position { get; set; }
      11:  }

    So, we have stored a bunch of objects of both types in the database, and now we want to run a JOIN query to get some of back.
    JOIN query

       1:  var queryResult = db.ExecuteQuery("SELECT sch, wp FROM School sch INNER JOIN WorkPlace wp ON ch.Location=wp.Location");

    Consider we have stored multiple instances of the following class in our database:
    Example classes

       1:   public class User
       2:   {
       3:     public Location CurrentLocation { get; set; }
       4:     public string Name { get; set; }
       5:     public DateTime BirthDate { get; set; }
       6:     public User[] Friends { get; set; }
       7:     public WorkPlace UserWorkPlace { get; set; }
       8:     public string[] Emails { get; set; }
       9:   }

    So, to find all users who has registered using the specific e-mail addresses, we can run a simple query with parameters:

    Array query

       1:  Parameters param = db.CreateParameters();
       2:  param.AddList("emails", new string[]{ "john@gmail.com", "david@hotmail.com" });
       3:   
       4:   
       5:  var res = db.ExecuteQuery("SELECT User WHERE Emails CONTAINS @emails", param);

    As I said, you can find fully working examples of the Eloquera applications by installing the Eloquera server on your development machine.

     

    Tags: , , ,

    Eloquera DB

    Welcome to Eloquera 2.0 (codename Woomera)!

    by Eloquera Team 17. August 2009 07:57

    Future starts today - you can download Eloquera 2.0 and find a new world of database programming.

    Eloquera is the object database for .NET. Eloquera supports native operations with objects, SQL queries, unique object identification for stateless environments like web applications (ASP.NET).
    Working with data never been easier. Add and update your object just by one line:
    Adding object to the database in Eloquera.

       1:    Shop shop = new Shop();
       2:    //That stores the object and all its linked objects.
       3:    db.Store(shop); 

    Run your queries in SQL on steroids (and you can use parameters for more flexibility):
    Running query for a complex object.

       1:     Parameters param = db.CreateParameters();
       2:     param["customerCountry"] = "Australia";
       3:   
       4:   
       5:     var complexData = db.ExecuteScalar("SELECT TOP 1 Shop" +
       6:                                        " WHERE Customer.Country = @customerCountry" +
       7:                                        " ORDER BY TotalAmount DESC", param);

    And you can use joins if your objects don't have relations:
    Joins in Eloquera queries.

       1:     var complexData = db.ExecuteQuery("SELECT school, wplace FROM School school" +
       2:                                       " INNER JOIN WorkPlace wplace" +
       3:                                       " ON ch.Location.City=wp.Location.City");
       4:   
       5:   
       6:     foreach(var item in complexData)
       7:     {
       8:        var pair = (IDictionary<string, object>)item;
       9:        Console.WriteLine("School {0} and company {1} are both located at {2}", 
      10:                           pair["school"], 
      11:                           pair["wplace"], 
      12:                           ((School)pair["school"]).Location.City);
      13:     } 

    Tags: , , , , ,

    Eloquera DB

    About the company

    Eloquera is an international company with offices in the US and Australia.

    The Eloquera's mission is to provide developers with fast, powerful, yet easy to use object database solution hence shortening time to market, reducing development and maintenance costs.

    The official Eloquera forum is available here

    Eloquera supports Open Source groups via Eloquera Open Source Group.

    For any enquiries just drop an email to our friendly staff info@eloquera.com or simply mail us at

    Eloquera
    P.O. 57484
    Chicago, IL 60657-0484
    USA

    Eloquera
    P.O. 611
    Missions Point, Sydney, NSW 1565
    Australia