Domain object models

Abstracts

A domain object model is an object that represent application data as a user, an employee, a product, etc.

Within this framework a domain object model (or simple a model) is a class that implement KpokPatagon.Data.IDataModel or that inherits from KpokPatagon.Data.DataModel (recommended), for example:

                    
        public class Audit : DataModel
        {
            //...   
        }
                    
                

Defining data properties

A data property is a property that represents application data that will be ultimately stored in a database.

A data property is defined as a normal C# property and it is decorated with an attribute that inherits from KpokPatagon.Data.IDataProperty, for example:

                    
        public class Audit : DataModel
        {
            string _id;

            [TextDataProperty("Id", DbType.Text, FieldName = "_id", MinLength = 0, MaxLength = 50, 
                PrimaryKey = 1, AutomaticType = AutomaticType.Identity, 
                Caption = "AuditIdCaption", ResourceType = typeof(ModelLabels))]
            public string Id
            {
                get { return _id; }
                set
                {
                    _id = value;
                    NotifyPropertyChanged(_id);
                }
            }
        }
                    
                

Creating, modifying and deleting

Data models are created, modified and deleted through the used of the methods Insert(...), Update(...), Delete(...), etc. from their respected data service.

Execution of this methods will execute the appropiated commands against the database.