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.
// And here is where the magic begins...
// Store the object - no conversion required
db.Store(cinema);
// Magic is not finished yet
// Get an object that matches the criteria
var movies = db.ExecuteQuery("SELECT Cinema WHERE ALL Movies.Studios.Titles CONTAINS '20th Century Fox'");
// Magic still goes on...
// Creating parameters
Parameters param = db.CreateParameters();
param["dt1"] = new DateTime(2006, 10, 1);
param["dt2"] = new DateTime(2009, 09, 17);
// And here we search for the values IN THE ARRAY!
var result = db.ExecuteQuery("SELECT Cinema WHERE OpenDates BETWEEN @dt1 AND @dt2", param);
// And here we do something good with the objects retrieved from the database
foreach (var cinema in result)
{
Console.WriteLine(cinema.ToString());
}
}
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
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 element in the configuration file will like this:
Server configuration.
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
net stop "Eloquera Server 2.0"
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
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
Consider we have stored multiple instances of the following class in our database:
Example classes
So, to find all users who has registered using the specific e-mail addresses, we can run a simple query with parameters:
Array query
As I said, you can find fully working examples of the Eloquera applications by installing the Eloquera server on your development machine.
Copyright © 2008-2012 Eloquera Corp. All rights reserved.