9using System.Collections.Generic;
12using System.Data.SqlClient;
17 public class ParentEntity : BusinessBase<ParentEntity>
19 #region "Business methods"
22 private string _notUndoable;
26 get {
return _notUndoable; }
27 set { _notUndoable = value; }
30 public static PropertyInfo<int>
IDProperty = RegisterProperty<int>(c => c.ID);
34 private set { LoadProperty(
IDProperty, value); }
37 public static PropertyInfo<string>
DataProperty = RegisterProperty<string>(c => c.Data);
66 #region "constructors"
83 #region "Factory Methods"
87 return dataPortal.
Create();
92 return dataPortal.
Fetch(
new Criteria(
ID));
105 private class Criteria
109 public Criteria(
int id)
117 #region "Data Access"
125 BusinessRules.CheckRules();
126 Console.WriteLine(
"DataPortal_Create");
133 Console.WriteLine(
"DataPortal_Fetch");
136 BusinessRules.CheckRules();
144 Console.WriteLine(
"DataPortal_Insert");
150 Console.WriteLine(
"DataPortal_Update");
158 Console.WriteLine(
"DataPortal_DeleteSelf");
166 Console.WriteLine(
"DataPortal_Delete");
bool IsDirty
Gets a value indicating whether this object's data has been changed.
Maintains metadata about a property.
static ParentEntity NewParentEntity(IDataPortal< ParentEntity > dataPortal)
void DataPortal_Fetch(object criteria, [Inject] IChildDataPortal< ChildEntityList > childDataPortal)
override void AddBusinessRules()
static PropertyInfo< int > IDProperty
static PropertyInfo< string > DataProperty
static ParentEntity GetParentEntity(int ID, IDataPortal< ParentEntity > dataPortal)
void DataPortal_Create([Inject] IChildDataPortal< ChildEntityList > childDataPortal)
ParentEntity()
DO NOT USE in UI - use the factory method instead
void DataPortal_DeleteSelf()
static PropertyInfo< ChildEntityList > ChildrenProperty
static void DeleteParentEntity(int ID, IDataPortal< ParentEntity > dataPortal)
void DataPortal_Delete(object criteria)
Static dictionary-like class that offers similar functionality to GlobalContext This is used in tests...
static void Reinitialise()
Reinitialise the dictionary, clearing any existing results, ready for the next test
static void Add(string key, string value)
Add an item to the test results, to indicate an outcome of a particular operation
Interface defining the members of the child data portal type.
Interface defining the members of the data portal type.
void Delete(params object[] criteria)
Called by a Shared (static in C#) method in the business class to cause immediate deletion of a speci...
object Fetch(params object[] criteria)
Called by a factory method in a business class to retrieve an object, which is loaded with values fro...
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
@ Serializable
Prevents updating or inserting until the transaction is complete.
@ Update
Update operation (includes insert, update and delete self).
@ Create
Create operation.
@ Delete
Delete operation.