Skip to content

MerlinModelBase

Squil11ams edited this page Nov 9, 2022 · 4 revisions

MerlinModelBase

This class implements the auto populating logic for the model.

It attempts to find the corresponding database column and cast it to the type of the field.

This class supports 3 attributes that can be used to facilitate the auto population logic.

Attributes

Exclude

[Exclude] simply tells the auto population logic to ignore this field.

AutoPopSettings

[AutoPopSettings(key)]

[AutoPopSettings(key, throwError, type, defaultValue)]

Lets you customize how the logic will attempt to locate and cast the database column.

key the name of the database column

throwError can use to either throw an error or suppress and use the defaultValue field.

type required to cast the default value.

defaultValue used if throwError is false.

MerlinObject

[MerlinObject]

[MerlinObject(flag)]

[MerlinObject(prefix)]

[MerlinObject(flag, prefix)]

Tells the auto population logic that this field implements the IMerlinObject interface and should be processed.

flag Not used by the auto populating logic but allows you to override the IMerlinObject.SetDataObject method to handle accordingly.

prefix Used to prepend characters to the database key to attempt to locate the record.

Clone this wiki locally