All objects in the BirdDog Software Framework inherit from IDomainObject which has standard properties:
- BeginEdit
- CancelEdit
- Delete
- ApplyEdit
Using the Factory and these properties any object can be Created | Loaded | Edited | Deleted | Saved.
Create or Load and then save to database:
Dim oUser As IUser
Try
oUser = AppCon.GetAppCon.Factory.UserLoaded("test@test.com)
Catch ex as Domain.RecordNotFoundException
oUser = AppCon.GetAppCon.Factory.UserNew(test@test.com, "pass")
End Try
With oUser
.BeginEdit 'This is not required...gets called automatically when you change a property
.FName="Test"
.LName = "User"
.ApplyEdit 'Saves to the database
End With
Load and then delete:
Dim oUser As IUser
Try
oUser = AppCon.GetAppCon.Factory.UserLoaded("test@test.com)
oUser.Delete
oUser.ApplyEdit
Catch ex as Domain.RecordNotFoundException
'Doesn't exist
End Try