A simple Entity

A simple entity can be expressed by the following code:
E# v2.0
using NBusiness.Templates;

family Business 
     entity Simple as EntityBase
          field auto id int Sid;
          field string Data;

using System;
using System.Data;
using NBusiness.Data;

namespace Business
    public partial class Simple : EntityBase
        private int _Sid;
        public int Sid { /* ... */ }

        private string _Data;
        public string Data { /* ... */ }

        //Various data access factories and rule initialization methods.

Usage (C#)
private void SimpleEntityExample()
    Simple s = Simple.CreateNew();
    s.Data = "a simple example";

    Assert.IsTrue(s.Sid > 0);        //The id is auto assigned after the first time it is saved.

Here is an example of a more complex entity.

Next: Creating relationships

Last edited Sep 5, 2007 at 1:28 AM by justinc, version 16


No comments yet.