EOMono is an assembly that provides database access and command logic to an ODBC connected database similiar to the EOModel / EOEntity / EOGenericRecord from the NextStep / OpenStep database interface.
EOMono was created for a couple of reasons:
- The ODBC provider in Mono is a very limited provider, so many of the advanced features of the ADO model don't work. This includes named parameters. So code to access an ODBC connected database ends up being littered with string building code to create the required SQL.
- I really really don't like fiddling around with strings when I want to be doing application Logic.
- The Mono ODBC provider receives basically zero love from the Mono team, so one can't expect this situation to improve anytime in the near future.
- I've used the EO model while working on OpenGroupware and using SOPE. This framework is quite handy, sophisticated enough without being overly complicated.
- EOMono is also influenced by the Logic layer in OpenGroupware which uses command objects to perform actions. The Logic layer is simply the best encapsulation of function I've ever seen.
NOTE: EOMono isn't at all intended to be in any way "compatible" with EO or NextStep or to duplicate the syntax exactly. It just borrows the ideas.
Objects
- EOModel - Represents a database or collection of tables.
- EOEntity - Represents a table, and its schema, in the database.
- EORecord - Represents a record in the database.
- EOConnection - Manages the connection to the database.
- EOCommand - Abstract parent class of database commands.
- EONull - Represents a NULL value.
Commands
- EOFetchCommand - Fetch: Used to retrieve records from a database.
- EOSetCommand - Set: Used to update a record in a database.
- EONewCommand - New: Used to insert a record into a database.
- EODeleteCommand - Delete: Used to delete a record from a database.
You can also draft your own commands, and commands that go beyond simple database functionality; for example code like:
try
{
connection.Run(":SyncGearWorksJobUpdates",
"proxy", "tyr:3128",
"username", "**********",
"password", "*********",
"start", DateTime.Now.AddHours(-1.0).ToString("yyyy-MM-dd HH:mm:00.000"),
"end", DateTime.Now.ToString("yyyy-MM-dd HH:mm:99.999"));
} catch (Exception _exception)
{in one of our internal applications executes once an hour to syncronize some database tables with an external SOAP web service; the above command requests the data and performs Fetch / Set / New commands to update the database.
Commands are just objects that implement the very simple IEOCommand interface, although most of the time it is sensible to also inherit from the abstract EOCommand object. Command objects are then mapped to names via an EOCommandAttribute attribute on the class:
[EOCommandAttribute("SyncGearWorksJobUpdates", 1, "Get job updates from Gearworks")]
public class GetUpdatedJobs : EOCommand, IEOCommand
{