Entity


Object Hierarchy:

Object hierarchy for Entity

Description:

public class Entity : Object

An Entity represents a record in a table, or the table itself when defining it to Almanna.

Example:

using Almanna;
public class Account : Entity {
public override string entity_name { owned get { return "account"; } }
public int account_id { get; set; }
public int account_status_id { get; set; }
public string username { get; set; }
public string password_hash { get; set; }
public DateTime date_created { get; set; }
public DateTime date_modified { get; set; }

public override void register_entity() {
add_column( new Column<int>.with_name_type( "account_id", "integer" ) );
columns["account_id"].size = 4;

add_column( new Column<int>.with_name_type( "account_status_id", "integer" ) );
columns["account_status_id"].size = 4;
columns["account_status_id"].is_nullable = true;

add_column( new Column<string>.with_name_type( "username", "character varying" ) );
columns["username"].size = 40;

add_column( new Column<string>.with_name_type( "password_hash", "character" ) );
columns["password_hash"].size = 40;

add_column( new Column<DateTime>.with_name_type( "date_created", "timestamp without time zone" ) );
columns["date_created"].size = 8;
columns["date_created"].is_nullable = true;

add_column( new Column<DateTime>.with_name_type( "date_modified", "timestamp without time zone" ) );
columns["date_modified"].size = 8;
columns["date_modified"].is_nullable = true;

try {
set_primary_key("account_id");
} catch (EntityError e) {
stderr.printf( "Error adding primary key to entity: %s\n", e.message );
}
}
}


Namespace: Almanna
Package: almanna

Content:

Properties:

Creation methods:

Methods:

Fields:

Inherited Members: