Business Objects
From CaisisWiki
(Difference between revisions)
(→Creating a New Business Object) |
(→Creating a New Business Object) |
||
Line 4: | Line 4: | ||
Before creating a new Business Object, you should look at the source code for an existing Business Object (preferably one that represents a database table similar to the one for which you are creating a new Business Object) and compare it to the structure of the database table it represents. | Before creating a new Business Object, you should look at the source code for an existing Business Object (preferably one that represents a database table similar to the one for which you are creating a new Business Object) and compare it to the structure of the database table it represents. | ||
+ | |||
+ | Consider the following snippet of Caisis.BusinessObject.Encounter.cs: | ||
+ | |||
+ | [Tablename("Encounters")] | ||
+ | [ParentTablename("Patients")] | ||
+ | [Disease("All")] | ||
+ | [Exportable] | ||
+ | [HasSiblings] | ||
+ | public class Encounter : BizObject | ||
+ | { | ||
+ | [NotNull] | ||
+ | [ParentKey] | ||
+ | [DataType(typeof(System.Int32))] | ||
+ | [Deidentify(DeidentifyOptions.Randomize)] | ||
+ | [LimitIdentification(LimitIdentificationOptions.Randomize)] | ||
+ | public static readonly String PatientId = "PatientId"; | ||
+ | |||
+ | [PrimaryKey] | ||
+ | [DataType(typeof(System.Int32))] | ||
+ | public static readonly String EncounterId = "EncounterId"; | ||
+ | |||
+ | [DataType(typeof(System.Byte))] | ||
+ | public static readonly String EncPending = "EncPending"; | ||
+ | |||
+ | [DataType(typeof(System.String))] | ||
+ | [Deidentify(DeidentifyOptions.Omit)] | ||
+ | public static readonly String EncDateText = "EncDateText"; | ||
+ | |||
+ | [DataType(typeof(System.DateTime))] | ||
+ | [Deidentify(DeidentifyOptions.MaskDate)] | ||
+ | public static readonly String EncDate = "EncDate"; | ||
+ | |||
+ | [DataType(typeof(System.String))] | ||
+ | public static readonly String EncType = "EncType"; | ||
+ | ... | ||
+ | } |
Revision as of 22:03, 2 November 2007
Business objects in Caisis represent database tables, allowing clients (e.g. Caisis.UI) to transparently store and retrieve data, and access table metadata.
Creating a New Business Object
Before creating a new Business Object, you should look at the source code for an existing Business Object (preferably one that represents a database table similar to the one for which you are creating a new Business Object) and compare it to the structure of the database table it represents.
Consider the following snippet of Caisis.BusinessObject.Encounter.cs:
[Tablename("Encounters")] [ParentTablename("Patients")] [Disease("All")] [Exportable] [HasSiblings] public class Encounter : BizObject { [NotNull] [ParentKey] [DataType(typeof(System.Int32))] [Deidentify(DeidentifyOptions.Randomize)] [LimitIdentification(LimitIdentificationOptions.Randomize)] public static readonly String PatientId = "PatientId"; [PrimaryKey] [DataType(typeof(System.Int32))] public static readonly String EncounterId = "EncounterId"; [DataType(typeof(System.Byte))] public static readonly String EncPending = "EncPending"; [DataType(typeof(System.String))] [Deidentify(DeidentifyOptions.Omit)] public static readonly String EncDateText = "EncDateText"; [DataType(typeof(System.DateTime))] [Deidentify(DeidentifyOptions.MaskDate)] public static readonly String EncDate = "EncDate"; [DataType(typeof(System.String))] public static readonly String EncType = "EncType"; ... }