-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Squil11ams edited this page Nov 9, 2022
·
7 revisions
You have two options to setup your object model.
1st Extend the MerlinModelBase class to enable auto population of fields.
` class MyData : MerlinModelBase
{
public int record_id { get; set; }
public string record_name { get; set; }
public MyCustomEnum record_enum { get; set; }
} `
If the fields have the same name as the corresponding database column then thats all you need.
See the MerlinModelBase page for more options including the available attributes.
`class MyData : IMerlinObject
{
public int record_id { get; set; }
public string record_name { get; set; }
public MyCustomEnum record_enum { get; set; }
public void SetDataObject(IDataReader data, int Flag, string Prefix="")
{
this.record_id = (int)data["field_1"];
this.record_name = (string)data["field_2"];
this.record_enum = (string)data["field_3"];
}
}`