<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">	<channel>	<title>TMS Software</title>	<link>http://www.tmssoftware.com</link>	<language>en</language>	<pubDate>Fri, 17 May 2013 08:29:00 +0100</pubDate>	<docs>http://blogs.law.harvard.edu/tech/rss</docs>	<ttl>1440</ttl>	<generator>TMS Software</generator>	<image>		<url>http://www.tmssoftware.com/site/img/tmslogo.png</url>		<title>TMS Software</title>		<link>http://www.tmssoftware.com</link>	</image>
	<item>
		<title><![CDATA[TMS Aurelius in your iPhone]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=263</link>
		<author>Wagner Landgraf</author>
		<pubDate>Fri, 10 May 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>We have just released TMS Aurelius 2.1 with XE4 support. This "small" release took a little longer, but with a good reason for that: thanks to the new <a target="_blank" href="http://www.embarcadero.com/products/rad-studio/ios-development">iOS compiler provided in Delphi XE4</a>, now TMS Aurelius supports iOS devices, in addition to the already supported Win32, Win64 and OS X platforms!
<br><br>
As you might already know, the <a target="_blank" href="http://blog.marcocantu.com/blog/delphi_language_mobile_wp.html">new iOS compiler has some different concepts</a> than the traditional Win32 compiler we are used to. Automatic reference counting for objects and zero-based strings are the main ones, and also the fact that pointers usage is discouraged now.
<br><br>
But for those considering using this new iOS compiler, there is good news. Personally, I was surprised, in a positive way, how backward compatible it is. Of course it depends on your code. If it has heavy pointer usage, lots of low-level hacks, etc., you might have a lot of work to do. But other than this, there is a good chance that you code will work smoothly on iOS. I can speak for Aurelius. It can be considered a very new TMS product (a little more than one year passed since 1.0 release in January, 2012) so it uses several new language features like generics, new RTTI, among other recent additions that helps the code to be very clean, well structured and with almost no pointer usage. Making most of it to compile to iOS required minimum changes, and it worked fairly well (of course, all our tests passed, in both iOS simulator and iOS device).
<br><br>
I said it was easy to compile "most of it" because the only exception was TAureliusDataset. Not that it was a nightmare, but without it, the other parts of TMS Aurelius would be compiling and running on iOS in a matter of minutes. But TAureliusDatset of course descends from TDataset which is a code that heavily uses pointers, internal buffers, etc.. So it required a some effort to convert.
<br><br>
All in all, you can have your TMS Aurelius code working on iOS, with all existing features, including TAureliusDataset and native SQLite support. And the best part is that you can use it the same way you do in Delphi: since TMS Aurelius already manages the memory in VCL/FMX applications (you usually don&#39;t have to worry about destroying objects retrieved from the database), you will have the same behavior in iOS. <br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Chrome-style application setting persistence/synchronisation with DropBox]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=262</link>
		<author>Bruno Fierens</author>
		<pubDate>Mon, 8 Apr 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P><a href="https://www.google.com/intl/en/chrome/browser/" target="_blank">Google Chrome</a> has the very interesting feature to be able to store its settings via your Google account. This means that when you install Chrome on a different machine and associate it with your Google account, it will automatically "inherit" all settings of your other configs. Not only Google Chrome does this but increasingly Windows desktop applications and tools use online storage to offer the convenience of having identical configurations on multiple machines. Another excellent example is the Google Chrome extension <a href="https://chrome.google.com/webstore/detail/speed-dial-2/jpfpebmajhhopeonhlcgidhclcccjcik?hl=en" target="_blank">Speed Dial 2</a> that can synchronize its settings among machines this way.<br><br>
Now, nothing prevents us from doing the same for a Delphi application and with the <a href="cloudpack.asp">TMS Cloud Pack</a>, it becomes very simple to use a cloud storage service such as <a href="http://www.dropbox.com" target="_blank">DropBox</a> to allow the user to persist his settings in a DropBox folder and have these settings synchronised between different machines this way.<br><br>

We have created a very rudimentary example to demonstrate the concept. The settings from the sample application are simply the contents of a listbox where items can be added or removed via the application. We save the settings as a simple text file and load this at application startup time from a DropBox account and save it back to DropBox when the application closes.
<img src="http://www.tmssoftware.com/site/img/dropboxpersist1.png"><p class="clear"></p>
<br><br>
All we need to do is drop an instance of TAdvDropBox from the <a href="cloudpack.asp">TMS Cloud Pack</a> on the form, set the DropBox application key and secret (that can be obtained for free after registering with DropBox) load the access tokens and when the access tokens do not yet exist, get an access token for DropBox via an authentication/authorization step and call one line of code to download the settings file.<br>When the application closes, we simply upload the settings again with one call.<br>
When we save the access token (here for reasons of simplicity of the demo in an INI file), this one time authentication/authorization with the DropBox account by the user is sufficient (which is similar for Google Chrome settings synchronisation too by the way)
<br>
The code with information in comments for application startup becomes:

<pre name=code class=delphi>
procedure TForm1.FormCreate(Sender: TObject);
var
  acc: boolean;
begin
  Dirty := false;
  // set the DropBox application key & secret here that is provided by DropBox
  // for free when registering via: https://www.dropbox.com/developers/apps
  AdvDropBox1.App.Key := DropBoxAppkey;
  AdvDropBox1.App.Secret := DropBoxAppSecret;
  // Use simple INI file storage for the access token that DropBox will give
  AdvDropBox1.PersistTokens.Location := plIniFile;
  AdvDropBox1.PersistTokens.Key := &#39;.\sync.ini&#39;;
  AdvDropBox1.PersistTokens.Section := &#39;DropBox&#39;;

  if AdvDropBox1.App.Key <> &#39;&#39; then
  begin
    // Try to load an access token if it was already retrieved earlier
    AdvDropBox1.LoadTokens;
    // Test if the token is working
    acc := AdvDropBox1.TestTokens;
    if not acc then
      // If the token was not working try to refresh it
      acc := AdvDropBox1.RefreshAccess;

    if not acc then
    // No token was found or existing token is not valid, so authenticate/authorize via DropBox
      AdvDropBox1.DoAuth
    else
    // Download the settings from DropBox and apply
      LoadSettings;
  end;
end;</pre>
When the application is first used, there is no access token to download a file from the users DropBox account and in this condition, first the DropBox authentication login screen is shown:<br>
<img src="http://www.tmssoftware.com/site/img/dropboxpersist2.png"><p class="clear"></p><br>
followed by the authorization screen:<br>
<img src="http://www.tmssoftware.com/site/img/dropboxpersist3.png"><p class="clear"></p><br>
When the access token is obtained the first time, the TAdvDropBox component triggers OnReceivedAccessToken from where the token is first saved and then the settings downloaded and applied:

<pre name=code class=delphi>procedure TForm1.AdvDropBox1ReceivedAccessToken(Sender: TObject);
begin
  AdvDropBox1.SaveTokens;
  LoadSettings;
end;</pre>
<br>
When the application closes, we can simply save the settings in the Form&#39;s OnClose event via:

<pre name=code class=delphi>procedure TForm4.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  listbox1.Items.SaveToFile(GetSettingsFileName);

  if Dirty and AdvDropBox1.TestTokens then
    AdvDropBox1.Upload(nil,GetSettingsFileName);
end;</pre>
<br>
The full source of the sample can be download <a href="http://www.tmssoftware.com/download/settingspersist.zip">here</a>. 
With the <a href="cloudpack.asp">TMS Cloud Pack</a> offering similar access also to <a href="https://skydrive.live.com/" target="_blank">Microsoft Skydrive</a> and <a href="https://drive.google.com" target="_blank">Google Drive</a>, it becomes very easy to change to the cloud storage of your preference by swapping to the component TAdvGDrive or TAdvSkyDrive.
<br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Feature request voting system on TMS website ... 9 months later]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=260</link>
		<author>Nancy Lescouhier</author>
		<pubDate>Fri, 29 Mar 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>Since July 2012, the website offers feature request voting capabilities for registered TMS customers. New request can be added, requests can be filtered and you can vote on requests from other customers.Now 9 months later, we’ve made an evaluation of our feature request voting system. The results:<br><br>

<strong>115 requests</strong><br>

We’ve received 115 requests from our customers. <br>
Components can be used in many different ways, so you are in the best position to determine which capabilities a control must have to be 100% functional in your application. Please keep on adding new requests, and help us to further extend our range of components offerings and enhance the feature set and quality of our components.  All your suggestions are welcome to further improve our existing components. And of course suggestions for new components are also welcome.<br><br>

Your opinion is highly appreciated and will be taken in account!<br><br>

<strong>28 implemented requests</strong><br>

And now the good news, 28 requests have been implemented.<br>
Several new capabilities and features were added to existing components but most importantly we&#39;ve added 3 completely new components!  <br><br>

<i>YOUR requests resulted in following new components:</i><br>
<ul>
<li>A new syntax highlighting memo control for FireMonkey: <a href="http://www.tmssoftware.com/site/tmsfmxpack.asp">TTMSFMXMemo</a></li>
<li>A new  VCL mapping component to integrate, display & control OpenStreetMaps in VCL Windows applications : 
<a href="http://www.tmssoftware.com/site/webosmaps.asp">TMS WebOSMaps</a></li>
<li>A new OpenGL 3D multi-serie chart component: <a href="http://www.tmssoftware.com/site/advchart.asp">TMS TAdvChartView3D</a></li>
</ul>
<img src="http://www.tmssoftware.com/site/img/FeatureRequestBlog.png" width=650>
<br>
<p class="clear"></p>

<i>Overview new capabilities and features in existing components:</i><br>
<ul>
<li>New: TWebGMapsDirectionList control to show steps of direction info in <a href="http://www.tmssoftware.com/site/webgmaps.asp">TMS WebGMaps</a>
<li>New: Support to show & interact with polylines on map in <a href="http://www.tmssoftware.com/site/webgmaps.asp">TMS WebGMaps</a>
<li>New: Support to show & interact with polygons on map in <a href="http://www.tmssoftware.com/site/webgmaps.asp">TMS WebGMaps</a>
<li>New: TWebGMapsReverseGeocoding component added in <a href="http://www.tmssoftware.com/site/webgmaps.asp">TMS WebGMaps</a>
<li>New: Multiline tab capability added in <a href="http://www.tmssoftware.com/site/aop.asp">TAdvOfficePager</a>
<li>New: Extended design-time style gallery in <a href="http://www.tmssoftware.com/site/advgrid.asp">TAdvStringGrid</a>
<li>Improved: Using grid.Ints[] now returns the rounded value when the cell contains a float in <a href="http://www.tmssoftware.com/site/advgrid.asp">TAdvStringGrid</a>
<li>New: Full JSON support makes it easy to build distributed applications in <a href="http://www.tmssoftware.com/site/aurelius.asp">TMS Aurelius</a>

<li>New: Update Database Schema feature (TDatabaseManager.UpdateDatabase method) in <a href="http://www.tmssoftware.com/site/aurelius.asp">TMS Aurelius</a>
<li>New: Support for FIBPlus components in <a href="http://www.tmssoftware.com/site/aurelius.asp">TMS Aurelius</a>

<li>New: KeyBoard and Mouse Wheel handling support in <a href="http://www.tmssoftware.com/site/tmsfmxpack.asp">TTMSFMXSpinner</a>
<li>New: Support for TTMSFMXBitmap in <a href="http://www.tmssoftware.com/site/tmsfmxpack.asp">TTMSFMXBarButton</a>
<li>New: Added capability to define multiple separator characters in <a href="http://www.tmssoftware.com/site/advlisteditor.asp">TAdvListEditor</a>
<li>New: Spacing added for items in lookup dropdown in <a href="http://www.tmssoftware.com/site/advlisteditor.asp">TAdvListEditor</a>
<li>New: LookupPopup.ValueSeparator property added in <a href="http://www.tmssoftware.com/site/advlisteditor.asp">TAdvListEditor</a>
<li>New: Added property MaxItems in <a href="http://www.tmssoftware.com/site/advlisteditor.asp">TAdvListEditor</a>
<li>New: Font in lookup dropdown customizable in <a href="http://www.tmssoftware.com/site/advlisteditor.asp">TAdvListEditor</a>
<li>New: Event OnTabInsert added in <a href="http://www.tmssoftware.com/site/aot.asp">TAdvOfficeTabSet </a>
<li>New: CaptionMarginRight and CaptionWordWrap properties per item in <a href="http://www.tmssoftware.com/site/advsmoothcontrols.asp">TAdvSmoothListBox</a>
<li>New: ShowLegend and ShowTotal properties to optionally show/hide the legend and total values in <a href="http://www.tmssoftware.com/site/advsmoothcontrols.asp">TAdvSmoothCapacityBar</a>
<li>New: ButtonBorderColor in <a href="http://www.tmssoftware.com/site/advsmoothcontrols.asp">TAdvSmoothPopup</a>
<li>Improved: AnnotationTopHeight and AnnotationBottomHeight to return the used space by the annotations in <a href="http://www.tmssoftware.com/site/advsmoothcontrols.asp">TAdvSmoothTimeline</a>
<li>Improved: csAcceptControls flag added to allow adding controls inside the control in <a href="http://www.tmssoftware.com/site/advsmoothcontrols.asp">TAdvSmoothTimeLine</a>
<li>New: Method GetVersionInfoOfApp() method added in <a href="http://www.tmssoftware.com/site/exeinfo.asp">TExeInfo</a>
<li>New: TAdvToolBarPage BeginUpdate/EndUpdate methods added in <a href="http://www.tmssoftware.com/site/advtoolbar.asp">TMS Advanced Toolbars & Menus</a> 
<li>New: Added capability to copy items in the design time editor in <a href="http://www.tmssoftware.com/site/advpolylist.asp">TMS Advanced Poly List</a>
</ul>

<strong>654 votes on requests</strong><br>

Not only new requests were added to our list, but you also voted on existing requests. This helps us to set the right priorities and goals.<br><br>
If you want to have a look at the list with requests or you want to add a new request, the overview page can be found here: <a href="http://www.tmssoftware.com/site/fr.asp">http://www.tmssoftware.com/site/fr.asp</a>
<br>
We at TMS are always trying to improve our products and bring them to a new level. 
We plan to add several new features in upcoming releases, our team is already busy with implementing your requests!<br>





<br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Preparation for TMS Day April 25 in full force]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=259</link>
		<author>Bruno Fierens</author>
		<pubDate>Mon, 25 Mar 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>Preparation of the <strong>TMS Day scheduled for April 25</strong> is in full force now. We’re working hard on every little detail, going from papers for the hand-outs, evaluation forms, training certificates, a gift attendees will receive to of course most importantly the content of the sessions itself. The tentative day scheme will be:<br><br>

<strong>Effectively using Flexcel for VCL & FireMonkey by Adrian Gallero, Flexcel architect</strong><br>
<br>
Adrian Gallero will give an allround overview of Flexcel and how the product can be used most effectively. <br>
<ul>
<li>Intro: Technical background why OLE Automation doesn&#39;t cut it and why to use Flexcel instead
<li>Details about the Flexcel API and using the  APIMate tool to be more productive in using the Flexcel API and some information about what is not in APIMate. 
<li>Using Flexcel based reports and how they can be used for much more than reports. Demo of an entire application created using Flexcel reports.
<li>Getting the most out of Flexcel rendering: exporting to HTML, PDF, printing, etc and how to make an Excel file so it prints fine. 
<li>Getting the most performance out of Flexcel in particular using the  virtual mode, a unique feature in FlexCel
<li>Using Flexcel with FireMonkey and using it in iOS applications with demo of Flexcel in the newest Delphi version and its new compiler for iOS.
</ul>
<br>
<strong>Learning Aurelius by example with DataSnap REST Servers by Wagner Landgraf, Aurelius architect</strong><br>
<br>
A step by step presentation how the Delphi ORM Aurelius can be used to create an issue tracker from scratch.<br>
<ul>
<li>Aurelius basic mapping/connection between Delphi classes and database tables
<li>A look at the memory management concept of the object manager
<li>The TAureliusDataset concept to bind entities automatically to controls
<li>Overview of specific TAureliusDataset features: enumname, subproperties, lookup fields, entity fields, master-detail
<li>Using & implementing queries from Aurelius
<li>Switching between database servers, or how easy Aurelius makes it for you to switch database servers
<li>Creating REST server and using Aurelius JSON serializer/deserializer to send/receive entities
<li>Accessing Aurelius data from JavaScript
</ul>
<br>
<strong>TMS VCL Components tips & tricks by Bruno Fierens, VCL component architect</strong><br>
<br>
Bruno Fierens will walk through several TMS VCL components showing advanced techniques.<br>
<ul>
<li>Understanding and using filtering in TAdvStringGrid: various automatic filtering techniques from the user interface, logical operations between filter conditions
<li>Using custom controls as inplace editors in the grid
<li>Creating a custom styler & custom autocompletion for TAdvMemo
<li>Using form-wide and application-wide styles for TMS VCL components
<li>Various scenarios and use cases for TWebUpdate, the automatic application updater
<li>Metro style UI’s with TMS Components
</ul>
<br>
<strong>TMS FireMonkey components for business applications by Pieter Scheldeman, FireMonkey component architect</strong><br>
<br>
Pieter Scheldeman will unveil the architecture and features of the FireMonkey tableview and grid component.<br>
<ul>
<li>Architecture of the tableview component, features, how its items can be customized and important performance aspects
<li>Architecture of the grid component, design decisions, features
<li>Using LiveBinding with the grid component
<li>Customization of the grid via editing its style
<li>Creating and using custom cell classes for the grid
<li>TMS FireMonkey components for iOS, sneak peek at newest developments specifically for iOS with the new Delphi version
</ul>
<br>
<strong>Connecting Delphi application to the cloud with the TMS Cloud Pack by Bruno Fierens, VCL component architect</strong><br>
<br>
Discover how your applications can benefit from consuming cloud services, getting data from the cloud, putting information in the cloud.<br>
<ul>
<li>Consuming cloud services from Delphi applications
<li>The OAuth challenge
<li>TMS Cloud Pack component architecture and component overview
<li>Connecting the VCL Planner components to the Google Calendar and Windows Live services
<li>Creating a custom cloud service access component using the TMS Cloud Pack  framework
</ul>
<br>
<br>
Other than the sessions, the entire TMS team will be available all day at your disposition to listen to your project specific questions and suggestions. For location, prices and reservation for the last 2 seats, see <a href="http://www.be-delphi.com" target="_blank">www.be-delphi.com </a><br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Visual Data Binding using TAureliusDataset]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=258</link>
		<author>Wagner R. Landgraf</author>
		<pubDate>Fri, 22 Mar 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>When dealing with Aurelius and any ORM framework, one common task is to build a graphical user interface to edit/display the data. Delphi users are used to the TDataset component, which not only retrieves data from the database but also act as middle layer between the data and visual controls. When using Aurelius, you don&#39;t use any TDataset descendant to directly retrieve data - all business data are objects that are retrieved by Aurelius itself.
<BR><BR>
To bind your objects to visual controls, you could use the new Visual Live Bindings feature. But Aurelius also provides an additional way of doing that - you can use TAureliusDataset, a TDataset descendant which behaves as any other TDataset - the only difference is that entity objects are the "data" for this dataset.
<BR><BR>
Consider the following code:
<pre name=code class=delphi>
var
  Customers: TList&lt;TCustomer&gt;;
  Dataset: TAureliusDataset;
{...}
  Customers := Manager.Find&lt;TCustomer&gt;.List;
  Dataset.SetSourceList(Customers);
  Dataset.Open;
</pre>
The first line retrieves a list of TCustomer objects from the database. The second line tells the dataset that its data is coming from Customers list, and then third line just opens the dataset. Now if we want to display our data in a TDBGrid control, for example, we just do it the way we are used to: link the grid to a TDatasource, then link the datasource to the TAureliusDataset. Your customers will be displayed in the grid.
<BR><BR>
TAureliusDataset automatically maps each property to a field in dataset. So if your customer is declared like this:
<pre name=code class=delphi>
type
  TCustomer = class
  {...}
    property CustName: string read FCustName write FCustName;
</pre>
you will be able to read/write the property using this code:
<pre name=code class=delphi>
CurrentName := Dataset.FieldByName(&#39;CustName&#39;).AsString;
Dataset.Edit;
Dataset.FieldByName(&#39;CustName&#39;).AsString := CurrentName + &#39; - sufix&#39;;
Dataset.Post;
</pre>
You could also edit a single object directly, without needing to retrieve a list. This will also work if you just want to edit properties of a single object:
<pre name=code class=delphi>
SpecificCustomer := Manager.Find&lt;TCustomer&gt;(CustomerId);
Dataset.SetSourceObject(SpecificCustomer);
Dataset.Open;
</pre>
Some could say that you could use the new Visual Live Bindings. Yes, of course, you can. This is just another option, with pros and cons. But it has some interesting/different things:
<BR><BR>
1. <strong>You can use existing data-aware controls</strong>. Delphi is now 18 year-old. There are numerous existing controls that support TDataset, but not live bindings. Data-aware grids, planners, controls, etc.. All of those can be used and be bound to the objects.
<BR><BR>
2. <strong>TDataset provides a temporary cache/buffer</strong>. This means that until you effectively Post, objects are not changed. Remember this acts as a TDataset. While the dataset is being edited and field contents are updated, only the internal dataset buffer is updated. Data is effectively saved in the objects (the "data") only after Post. This gives you great flexibility when you need to build user interfaces where user can cancel changes, or only update data when clicking "Ok". If you use live bindings, you would have to do something else to achieve such behavior.
<BR><BR>
Not only that, TAureliusDataset is not just a property->field mapper. It&#39;s really powerful. Here is a list of many things TAureliusDataset can do and features it supports (I might write about these in a future post):
<BR><BR>
<ul>
<li>Fetch-on-demand (will talk about this in a future post)</li>
<li>Offline, paged fetch-on-demand (same as above)</li>
<li>Sub-properties (properties of associated entities)</li>
<li>Entity fields (fields representing an association)</li>
<li>Dataset fields (master-detail)</li>
<li>Supports inheritance/polymorphism (list of objects of different classes)</li>
<li>Enumerated types</li>
<li>Lookup fields</li>
<li>Locate/Lookup methods</li>
<li>Filtered data</li>
<li>Calculated fields</li>
<li>Design-time support</li>
</ul>
To conclude, here are two screenshots that illustrate how you can use TAureliusDataset at design-time: <BR><BR>
<img src="http://www.tmssoftware.com.br/aurelius/doc/web/datasetdesigntimemenuoption.png"><BR>
<img src="http://www.tmssoftware.com.br/aurelius/doc/web/datasetdesigntimeimportfields.png">
<br>
<br>
<p class="clear"></p>
<br>
<br><br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Crash Course TMS Aurelius – Inheritance and Polymorphism]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=256</link>
		<author>Wagner Landgraf</author>
		<pubDate>Fri, 8 Mar 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>Inheritance is one of my favorite features in Aurelius. One of benefits of using an ORM is abstracting the SQL and start thinking (almost) purely in OOP. Inheritance and polymorphism are<a target="_blank" href="http://en.wikipedia.org/wiki/Object-oriented_programming#Fundamental_features_and_concepts"> fundamental features of Object-oriented programming</a>, and if when designing your model you can&#39;t use it, then the "object-relational" mapping would just become a simple "property>column" mapping in the end. 
<br><br>
Aurelius allows you to build a class hierarchy that can be persisted, and provides you with two strategies to persist it: joined tables and single table. The former will create a different table for each class and add the proper relationships, and the later will save the whole hierarchy in the same table. You can learn more about it reading the topic "<a target="_blank" href="http://www.tmssoftware.com.br/aurelius/doc/web/index.html?inheritange_strategies.htm">Inheritance Strategies</a>" in documentation.
<br><br>
Let me illustrate how it works. Considering the following classes and mapping:
<pre name=code class=delphi>
type
  [Entity, Automapping]
  [Inheritance(TInheritanceStrategy.JoinedTables)]
  TPerson = class
  private
    FId: integer;
    FName: string;
  public
    property Id: integer read FId write FId;
    property Name: string read FName write FName;
  end;

  [Entity, Automapping]
  TEmployee = class(TPerson)
  private
    FSalary: Currency;
  public
    property Salary: Currency read FSalary write FSalary;
  end;
</pre>
Note that mapping is also very straightforward, all you need to do is specify the strategy to be used in the base class of your hierarchy. Now you can save your objects in the same way we did in previous posts:
<pre name=code class=delphi>
function SavePerson(Manager: TObjectManager): integer;
var
  Person: TPerson;
begin
  Person := TPerson.Create;
  Person.Name := &#39;John Person&#39;;
  Manager.Save(Person);
  Result := Person.Id;
end;

function SaveEmployee(Manager: TObjectManager): integer;
var
  Employee: TEmployee;
begin
  Employee := TEmployee.Create;
  Employee.Name := &#39;James Employee&#39;;
  Employee.Salary := 1999.99;
  Manager.Save(Employee);
  Result := Employee.Id;
end;
</pre>
After calling the above methods, we have one TPerson object and one TEmployee object persisted in the database. We can use the following code to retrieve them using the generated id&#39;s:
<pre name=code class=delphi>
procedure OutputPerson(Person: TPerson);
begin
  if Person <> nil then
    WriteLn(Format(&#39;Class: %s; Name: %s&#39;, [Person.ClassName, Person.Name]))
  else
    WriteLn(&#39;nil&#39;);
end;

procedure OutputEmployee(Employee: TEmployee);
begin
  if Employee <> nil then
    WriteLn(Format(&#39;Class: %s; Name: %s; Salary: %s&#39;,
      [Employee.ClassName, Employee.Name, FloatToStr(Employee.Salary)]))
  else
    WriteLn(&#39;nil&#39;);
end;

procedure CheckPersonAndEmployee(Manager: TObjectManager; PersonId, EmployeeId: integer);
var
  Person: TPerson;
  Employee: TEmployee;
begin
  Person := Manager.Find&lt;TPerson&gt;(PersonId);
  OutputPerson(Person);
  Person := Manager.Find&lt;TPerson&gt;(EmployeeId);
  OutputPerson(Person);
  Employee := Manager.Find&lt;TEmployee&gt;(EmployeeId);
  OutputEmployee(Employee);
  Employee := Manager.Find&lt;TEmployee&gt;(PersonId);
  OutputEmployee(Employee);
end;
</pre>
This is what we get as the output:
<pre name=code class=xml>Class: TPerson; Name: John Person
Class: TEmployee; Name: James Employee
Class: TEmployee; Name: James Employee; Salary: 1999.99
nil
</pre>
Now you see polymorphism in action. The first two Find calls ask for a TPerson object. It happens that the first id is a TPerson object indeed, but the second is an id for a TEmployee object. Both are retrieved because a TEmployee is a TPerson. Also note that the retrieved object in second Find is actually a TEmployee object.
<br><br>
The last two Find calls ask for a TEmployee object. When the EmployeeId is provided, the correct TEmployee object is retrieved. But when we ask for a TEmployee object passing PersonId as Id, nil is returned - although the object is in database with that id, it&#39;s not returned because the object is not a TEmployee, but only a TPerson.
<br><br>
As in the previous posts, I will provide here some SQL statements generated by Aurelius, for a better understanding. When using joined tables strategy, Aurelius will create the following database structure (SQL Server syntax):
<pre name=code class=sql>
CREATE TABLE PERSON (
  ID INTEGER IDENTITY(1,1) NOT NULL,
  NAME VARCHAR(255) NOT NULL,
  CONSTRAINT PK_PERSON PRIMARY KEY (ID));

CREATE TABLE EMPLOYEE (
  ID INTEGER NOT NULL,
  SALARY NUMERIC(20, 4) NOT NULL,
  CONSTRAINT PK_EMPLOYEE PRIMARY KEY (ID));

ALTER TABLE EMPLOYEE ADD CONSTRAINT 
  FK_EMPLOYEE_PERSON_ID FOREIGN KEY (ID) REFERENCES PERSON (ID);
</pre>

Each class will have its data saved in a different database, and retrieving a TEmployee object would execute the following statement:

<pre name=code class=sql>
SELECT A.ID AS A_ID, A.SALARY AS A_SALARY, B.ID AS B_ID, B.NAME AS B_NAME
FROM EMPLOYEE A
  LEFT JOIN PERSON B ON (B.ID = A.ID)
WHERE  B.ID = :p_0
</pre>

To conclude this post, let&#39;s change the strategy to single table. This will make the mapping look like this (Salary property has to be nullable because all data will stay in a single table):
<pre name=code class=delphi>
  [Entity, Automapping]
  [Inheritance(TInheritanceStrategy.SingleTable)]
  [DiscriminatorColumn(&#39;PERSON_TYPE&#39;, TDiscriminatorType.dtString)]
  [DiscriminatorValue(&#39;Person&#39;)]
  TPerson = class
  private
    FId: integer;
    FName: string;
  public
    property Id: integer read FId write FId;
    property Name: string read FName write FName;
  end;

  [Entity, Automapping]
  [DiscriminatorValue(&#39;Employee&#39;)]
  TEmployee = class(TPerson)
  private
    FSalary: Nullable&lt;Currency&gt;;
  public
    property Salary: Nullable<Currency> read FSalary write FSalary;
  end;
</pre>
Code will be exactly the same. Database structure will become just this:
<pre name=code class=sql>
CREATE TABLE PERSON (
  ID INTEGER IDENTITY(1,1) NOT NULL,
  NAME VARCHAR(255) NOT NULL,
  PERSON_TYPE VARCHAR(30) NOT NULL,
  SALARY NUMERIC(20, 4) NULL,
  CONSTRAINT PK_PERSON PRIMARY KEY (ID));
</pre>
and this is how an employee is retrieved from database:
<pre name=code class=sql>
SELECT A.ID AS A_ID, A.NAME AS A_NAME, A.PERSON_TYPE AS A_PERSON_TYPE, A.SALARY AS A_SALARY
FROM PERSON A
WHERE A.PERSON_TYPE = :p_1
 AND A.ID = :p_0

p_0 = "1" (ftInteger)
p_1 = "Employee" (ftString)
</pre>
<br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Crash Course TMS Aurelius – Blobs]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=254</link>
		<author>Wagner Landgraf</author>
		<pubDate>Thu, 28 Feb 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>Using blobs in Aurelius is very straightforward and yet very powerful. In summary, all you have to do is declare your field/property as TBlob (declared in unit Aurelius.Types.Blob.pas). This is enough to map it to an existing blob field in your table, and you will be able to save/load the blob content is several many ways. Consider the following mapping:
<pre name=code class=delphi>
  [Entity, Automapping]
  TCustomer = class
  private
    FId: integer;
    FName: string;
    FDocument: TBlob;
    [Column(&#39;Photo&#39;, [TColumnProp.Lazy])]
    FPhoto: TBlob;
    [Column(&#39;Descr_Field&#39;, [], 65536)]
    FDescription: string;
  public
    property Id: integer read FId write FId;
    property Name: string read FName write FName;
    property Document: TBlob read FDocument write FDocument;
    property Photo: TBlob read FPhoto write FPhoto;
    property Description: string read FDescription write FDescription;
  end;
</pre>
We have declared three blob properties in our class: Document, Photo and Description. I have used those to show slightly different ways of using blobs. Document and Photo are declared as TBlob, which is the recommended way. Alternatively, Description is declared as string, but manually mapped to database using a size greater than 65535. This tells Aurelius to also consider this field as a blob (memo/cblob to be more specific) instead of VarChar. You could also declare the property as a dynamic array of byte, but it&#39;s not recommended, since you gain nothing from doing it. Note that I have also used an unusual field name for Description (Descr_Field) just to show you how manual mapping works.
<br><br>
There is another interesting feature about blobs: Photo is declared as lazy (TColumnProp.Lazy). This indicates that Aurelius will not bring the blob from database when Customer data is retrieved. The blob is only retrieved when your code explicitly reads the content of Photo property. 
<br><br>
The following code shows different ways of dealing with blobs (saving and loading):
<pre name=code class=delphi>
function SaveCustomerWithBlobs(Manager: TObjectManager): integer;
var
  Customer: TCustomer;
begin
  Customer := TCustomer.Create;
  Customer.Name := &#39;John&#39;;

  Customer.Photo := TFile.ReadAllBytes(&#39;picture.bmp&#39;);
  Customer.Document.AsBytes := TFile.ReadAllBytes(&#39;document.pdf&#39;);
  Customer.Description := TFile.ReadAllText(&#39;description.txt&#39;);

  Manager.Save(Customer);
  Result := Customer.Id;
end;

procedure LoadCustomerAndExportBlobs(Manager: TObjectManager; CustomerId: integer);
var
  Customer: TCustomer;
begin
  Customer := Manager.Find&lt;TCustomer&gt;(CustomerId);

  TFile.WriteAllText(&#39;description2.txt&#39;, Customer.Description);
  TFile.WriteAllBytes(&#39;document2.pdf&#39;, Customer.Document);
  TFile.WriteAllBytes(&#39;picture2.bmp&#39;, Customer.Photo.AsBytes);
end;
</pre>
As you can see, you can use TBlob.AsBytes property explicitly, or rely on the implicit conversion to TBytes. You could also use AsString property and streams:
<pre name=code class=delphi>
  Customer.Photo := TBlob.Create(TFile.ReadAllBytes(&#39;picture.bmp&#39;));
  Customer.Document.AsString := &#39;Some document&#39;;
  Stream := TFile.Open(&#39;picture.bmp&#39;, TFileMode.fmOpen);
  Customer.Photo.LoadFromStream(Stream);
  Stream.Free;
</pre>
TBlob type also offers methods like IsNull, Clear, and also provides direct access to raw data to improve performance if needed. 
<br><br>
As a final note: we have added TColumnProp.Lazy to the Photo blob. We can verify if the blob is loaded using the Loaded property. We can change LoadCustomerAndExportBlobs function to check it:
<pre name=code class=delphi>
  Customer := Manager.Find&lt;TCustomer&gt;(CustomerId);

  Assert(Customer.Document.Loaded);
  TFile.WriteAllBytes(&#39;document2.pdf&#39;, Customer.Document);

  Assert(not Customer.Photo.Loaded);
  TFile.WriteAllBytes(&#39;picture2.bmp&#39;, Customer.Photo.AsBytes);
  Assert(Customer.Photo.Loaded);
</pre>
After TCustomer instance is loaded, Document property is loaded, but Photo is not loaded, because we set it as lazy. After we access content of Photo to save it to picture2.bmp file, Photo.Loaded becomes true. You can also see it happening when you check the generate SQL statements:
<pre name=code class=sql>
CREATE TABLE CUSTOMER (
  ID INTEGER NOT NULL,
  NAME VARCHAR(255) NOT NULL,
  DOCUMENT BLOB,
  Photo BLOB,
  Descr_Field BLOB SUB_TYPE TEXT,
  CONSTRAINT PK_CUSTOMER PRIMARY KEY (ID));

CREATE GENERATOR SEQ_CUSTOMER;

SELECT GEN_ID(SEQ_CUSTOMER, 1)
FROM RDB$DATABASE;

INSERT INTO CUSTOMER (
  ID, NAME, DOCUMENT, Photo, Descr_Field)
VALUES (
  :A_ID, :A_NAME, :A_DOCUMENT, :A_Photo, :A_Descr_Field);

SELECT A.ID AS A_ID, A.NAME AS A_NAME, A.DOCUMENT AS A_DOCUMENT, A.Descr_Field AS A_Descr_Field
FROM CUSTOMER A
WHERE  A.ID = :p_0;

SELECT A.Photo As f0_
FROM CUSTOMER A
WHERE  A.ID = :p_0;
</pre>
The first statement shows how the table is created (Firebird in this example). The INSERT statement creates the customer in the database, and saves the blobs. The first SELECT statement retrieves only Document and Description, but not Photo. The last SELECT statement is executed later, to retrieve the content of Photo field, only when the content of Photo property is read from code.<br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Crash Course TMS Aurelius – Associations (Foreign Keys)]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=247</link>
		<author>Wagner Landgraf</author>
		<pubDate>Mon, 18 Feb 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>Besides mapping tables to classes and table columns to fields/properties, Aurelius also maps relationships (foreign keys) to object associations. One nice thing about Aurelius is that such associations are defined in a very simple way: just references to other objects. Consider the following classes with respective mapping:
<pre name=code class=delphi>
type
  [Entity, Automapping]
  TCountry = class
  private
    FId: integer;
    FName: string;
  public
    property Id: integer read FId write FId;
    property Name: string read FName write FName;
  end;

  [Entity, Automapping]
  TCustomer = class
  private
    FId: integer;
    FName: string;
    FCountry: TCountry;
  public
    property Id: integer read FId write FId;
    property Name: string read FName write FName;
    property Country: TCountry read FCountry write FCountry;
  end;
</pre>
Note that TCustomer has an association to TCountry, meaning that every customer has a country associated to it. The following code should how you would save a TCustomer object with an associated TCountry object:
<pre name=code class=delphi>
function CreateCustomerWithCountry(Manager: TObjectManager): integer;
var
  Customer: TCustomer;
  USACountry: TCountry;
begin
  USACountry := TCountry.Create;
  USACountry.Name := &#39;USA&#39;;
  Customer := TCustomer.Create;
  Customer.Name := &#39;John&#39;;
  Customer.Country := USACountry;
  Manager.Save(Customer);
  Result := Customer.Id;
end;
</pre>
Very simple and straightforward. Note that we didn&#39;t need to save Country object - when Customer is saved, Country is automatically saved because it&#39;s associated to it (this is the default behavior of automapping. You can fully configure the mapping to avoid Country to be saved automatically, if you want to).
<br><br>
It&#39;s also very simple to retrieve an object and its associations from database. Consider the following code that takes a customer id and returns the name of the country associated with the customer:
<pre name=code class=delphi>
function GetCountryNameFromCustomer(Manager: TObjectManager; CustomerId: integer): string;
var
  Customer: TCustomer;
begin
  Customer := Manager.Find&lt;TCustomer&gt;(CustomerId);
  if Customer <> nil then
    Result := Customer.Country.Name
  else
    Result := &#39;&#39;;
end;
</pre>
The code retrieves a TCustomer object instance based on the id (such Find method will be topic for another blog post). To obtain the name of the country, all we have to do is to get the associated TCountry object instance (through the TCustomer.Country property) and return its Name property. Also very simple. When TCustomer instance was retrieved, its associated objects were also retrieved. You can also fully configure this, and you can even set up things so that the TCountry object is only retrieved when needed (also a topic for another post).
<br><br>
Associations are a core feature of any ORM framework and this small example is a very simple one. Aurelius has many features related to associations, many ways of dealing with them, saving, retrieving, etc. But the purpose of this blog post is just to explain the concept. Feel free to ask questions in comment about what else you would like to be better explained in a future blog post.
<br><br>
To make it even more clear, I will post here the SQL statements executed by Aurelius when the code above was executed, so you can easily relate the objects with the underlying database. The statements used here were executed in an SQL Server database (syntax will be different if using another database).
<br><br>
The following statements were executed to create the tables so you can have an idea of the database structure (code to create the database is not explicit in this post):
<pre name=code class=sql>
CREATE TABLE COUNTRY (
  ID INTEGER IDENTITY(1,1) NOT NULL,
  NAME VARCHAR(255) NOT NULL,
  CONSTRAINT PK_COUNTRY PRIMARY KEY (ID));

CREATE TABLE CUSTOMER (
  ID INTEGER IDENTITY(1,1) NOT NULL,
  NAME VARCHAR(255) NOT NULL,
  COUNTRY_ID INTEGER NULL,
  CONSTRAINT PK_CUSTOMER PRIMARY KEY (ID));

ALTER TABLE CUSTOMER ADD CONSTRAINT 
  FK_CUSTOMER_COUNTRY_COUNTRY_ID FOREIGN KEY (COUNTRY_ID) REFERENCES COUNTRY (ID)
</pre>
When saving the TCustomer object instance (function CreateCustomerWithCountry), the following statements were executed (the content of parameters is displayed):
<pre name=code class=sql>
INSERT INTO COUNTRY (NAME) VALUES (:A_NAME);
A_NAME = "USA" (ftString)

SELECT CAST(IDENT_CURRENT(&#39;COUNTRY&#39;) AS INT);

INSERT INTO CUSTOMER (
  NAME, COUNTRY_ID)
VALUES (
  :A_NAME, :A_COUNTRY_ID);

A_NAME = "John" (ftString)
A_COUNTRY_ID = "1" (ftInteger)

SELECT CAST(IDENT_CURRENT(&#39;CUSTOMER&#39;) AS INT)
</pre>
Finally, and the most interested one in my opinion, this is the SQL statement executed to retrieve back the TCustomer obejct instance. Note that in this example two different TObjectManager objects were used to force the SELECT execution. If a single manager had been used, manager would have retrieved the object directly from manager and would not need to execute an extra SELECT statement to retrieve the data.
<pre name=code class=sql>
SELECT A.ID AS A_ID, A.NAME AS A_NAME, A.COUNTRY_ID AS A_COUNTRY_ID, B.ID AS B_ID, B.NAME AS B_NAME
FROM CUSTOMER A
  LEFT JOIN COUNTRY B ON (B.ID = A.COUNTRY_ID)
WHERE  A.ID = :p_0

p_0 = "1" (ftInteger)
</pre><br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Crash Course TMS Aurelius – AnyDAC or dbExpress?]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=246</link>
		<author>Wagner Landgraf</author>
		<pubDate>Mon, 11 Feb 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>In the example provided in the <a href="http://tmssoftware.com/site/blog.asp?post=245">previous post</a>, we saved a TCustomer instance in a local SQLite database which was accessed natively by TMS Aurelius. Let’s refactor that code a little bit:
<pre name=code class=delphi>
procedure SaveCustomer(Connection: IDBconnection; CustomerName: string);
var
  Manager: TObjectManager;
  Customer: TCustomer;
begin
  Manager := TObjectManager.Create(Connection);
  Customer := TCustomer.Create;
  Customer.Name := CustomerName;
  Manager.Save(Customer);
  Manager.Free;
end;
</pre>
With the procedure above, to save a customer in the SQLite database, we used a code similar to this (non-relevant lines removed):
<pre name=code class=delphi>
uses
  {…}, Aurelius.Drivers.SQLite,   Aurelius.SQL.SQLite;

  Connection := TSQLiteNativeConnectionAdapter.Create(&#39;test.db&#39;);
  SaveCustomer(Connection, &#39;Jack&#39;);
</pre>
What if we want to change it completely and save our objects in a MySQL database, using dbExpress to connect to it? That can be done this way:
<pre name=code class=delphi>
uses
  {…}, Aurelius.Drivers.dbExpress,   Aurelius.SQL.MySQL;

  Connection := TDBExpressConnectionAdapter.Create(SQLConnection1, &#39;MySQL&#39;, False);
  SaveCustomer(Connection, &#39;Joe&#39;);
</pre>
Note that besides the code that retrieves an IDBConnection interface, all other code remains the same. And that is true for any database you want to connect to, using any component, because all the object manager needs is an IDBConnection interface. 
<br><br>
To retrieve that interface, we used a component adapter (TDBExpressConnectionAdapter, declared in unit Aurelius.Drivers.dbExpress) that takes our current dbExpress connection component (a TSQLConnection named SQLConnection1) and retrieves the interface. The second parameter indicates which database we are connecting to (more specifically, which SQL dialect Aurelius needs to use to execute SQL statements). That dialect, &#39;MySQL&#39;, is available after you use the unit Aurelius.SQL.MySQL. Finally, the third parameter (False) indicates that when the IDBConnection interface is destroyed, the adapted component (SQLConnection1) should not be destroyed. Optionally you can set it to true, which can be useful if you are creating the component only to be used by IDBConnection, so that the component is destroyed when interface is destroyed.
<br><br>
Now that <a target="_blank" href="http://blog.marcocantu.com/blog/embarcadero_buys_anydac.html">Embarcadero has purchased AnyDac library</a> and it will probably be provided natively in Delphi, using it instead of dbExpress will be a matter of changing a couple of lines:
<pre name=code class=delphi>
uses
  {…}, Aurelius.Drivers.AnyDac,   Aurelius.SQL.MySQL;

  Connection := TDBExpressConnectionAdapter.Create(ADConnection1, False);
  SaveCustomer(Connection, &#39;Phil&#39;);
</pre>
You might be missing the second parameter indicating that we are connecting to a MySQL database. This is because the adapters are able to automatically identify the database being connected to (Both TSQLConnection and TADConnection components have a property DriverName which Aurelius uses to identify the database). So the second parameter is optional.
<br><br>
Another thing is worth noting is that with this approach, code is very abstract and flexible. Aurelius doesn’t have any connection parameters that you need to configure like server name, password, etc. Everything is configured in the same components you already use. Any database connection configuration, including advanced ones, provided by each database access components, is still available. 
<br><br>
So, if you don’t know if you should use <B>AnyDac</B> or <B>dbExpress</B>, you can use both and change them as you want to. Not only those, but at the current version (1.8) Aurelius also supports <B>ADO components, Direct Oracle Access, ElevateDB, NexusDB, Absolute Database, FIBPlus, IBObjects, IBX components, SQL-Direct, UniDac</B> and of course the <B>native SQLite</B> adapter. Aurelius documentation also provides the unit names and the name of adapter classes in its topic about <a target="_blank" href="http://www.tmssoftware.com.br/aurelius/doc/web/index.html?component_adapters.htm">component adapters</a>.
<br><br>
As for the supported databases, you can use not only <B>SQLite</B> and <B>MySQL</B>, but also <B>Firebird, MS SQL Server, Interbase, Oracle, PostgreSQL, Absolute Database, DB2, ElevateDB, NexusDB</B> and <B>SQLite</B>. The names of units and SQL dialects are available in the topic <a target="_blank" href="http://www.tmssoftware.com.br/aurelius/doc/web/index.html?sql_dialects.htm">“SQL Dialects” in documentation</a>.
<br><br>
To conclude, I would like to mention that not only those databases and components are supported, but they are also extensively tested in each Aurelius release, with almost all possible combinations (dbExpress connecting to SQL Server, AnyDac connecting to PostgreSQL, and so on). You can check in the documentation <a target="_blank" href="http://www.tmssoftware.com.br/aurelius/doc/web/index.html?components_databases_homologation.htm">which minimum versions of were used for tests</a> for each combination. So most of little problems here are there with field types, SQL syntax, among other common problems that we usually find when switching components and databases are already solved, making Aurelius code effectively database/component agnostic, not only in theory, but also in practice.<br><br></P>]]></description>
	</item>
	<item>
		<title><![CDATA[Crash Course TMS Aurelius – Getting Started]]></title>
		<link>http://www.tmssoftware.com/site/blog.asp?post=245</link>
		<author>Wagner Landgraf</author>
		<pubDate>Wed, 6 Feb 2013 12:00:00 +0000</pubDate>
		<description><![CDATA[<P>Even though TMS Aurelius provides <a target="_blank" href="http://www.tmssoftware.com.br/aurelius/doc/web/">extensive documentation</a>, I sometimes receive requests to provide more examples, sample codes and  explanations about how to accomplish some daily tasks. Thus, I will start a series of posts about how to use TMS Aurelius. Everything is already covered in the documentation, but here I will try not to provide complete, technical, “official” coverage of a feature, but plainly explain what it is for instead by giving real-world examples etc. - in summary, a different, hands-on way of showing things.
<BR><BR>
I will start right from the beginning. I want to show a small application using TMS Aurelius. Having an entity/a model class TCustomer, mapped as follows:
<BR>
<pre name=code class=delphi>
unit Customer;
interface
uses
  Aurelius.Mapping.Attributes;

type
  [Entity, Automapping]
  TCustomer = class
  private
    FId: integer;
    FName: string;
  public
    property Id: integer read FId write FId;
    property Name: string read FName write FName;
  end;

implementation
end.
</pre>
This is a very small application that saves a customer instance derived from TCustomer in a SQLite database (I&#39;ve removed try..finally blocks to simplify code):
<BR>
<pre name=code class=delphi>
program GettingStarted;

{$APPTYPE CONSOLE}

uses
  Aurelius.Drivers.Interfaces,
  Aurelius.Drivers.SQLite,
  Aurelius.Engine.DatabaseManager,
  Aurelius.Engine.ObjectManager,
  Aurelius.SQL.SQLite,
  Customer;

var
  Connection: IDBConnection;
  Manager: TObjectManager;
  Customer: TCustomer;
begin
  Connection := TSQLiteNativeConnectionAdapter.Create(&#39;test.db&#39;);
  Manager := TObjectManager.Create(Connection);
  Customer := TCustomer.Create;
  Customer.Name := &#39;First customer&#39;;
  Manager.Save(Customer);
  Manager.Free;
  WriteLn(&#39;Customer saved.&#39;);
  ReadLn;
end.
</pre>

The purpose here is to show the very basics of how to start using Aurelius. What you need is:
<BR><BR>
1. A class to be persisted. This is your TCustomer class.
<BR><BR>
2. A mapping between the class and the database. This is accomplished by the [Entity] and [Automapping] attributes. In this case properties are mapped automatically to database columns, but you can set up a custom mapping if you want to. I will call object instances managed by Aurelius “entities”.
<BR><BR>
3. A connection to a database. This is the Connection variable, which implements an IDBConnection interface. In this case, we are connecting to a local SQLite database and need to make use of the TSQLiteNativeConnectionAdapter. I.e. we always need an adapter that connects the database world to the object world. In Windows you have to make sure sqlite3.dll is in a directory Windows can find. In Mac OS X and iOS, SQLite is already available.
<BR><BR>
4. An object manager to persist and manage your entities. The second line creates an object manager,  which stores objects in the database specified by IDBConnection.
<BR><BR>
With all that, the code just instantiates the TCustomer object, fills its properties  and saves it to the database. That is your first TMS Aurelius application!
<BR><BR>
As an additional note with regard to the code sample, if the file “test.db” does not exist, Aurelius will create it for you. However, you have to explicitly ask it to create the database structure for you, using the following code:
<BR>
<pre name=code class=delphi>
procedure CreateDatabase(Connection: IDBConnection);
var
  DBManager: TDatabaseManager;
begin
  DBManager := TDatabaseManager.Create(Connection);
  DBManager.BuildDatabase;
  DBManager.Free;
end;
</pre>
This will create the file holding the database and the proper tables you need in database (in this case, table “Customer”).<br><br></P>]]></description>
	</item>
	</channel></rss>
