CSLA
Returns the current edit level of the object.
Copies the state of the object and places the copy
onto the state stack.
Restores the object's state to the most recently
copied values from the state stack.
Restores the state of the object to its
previous value by taking the data out of
the stack and restoring it into the fields
of the object.
Accepts any changes made to the object since the last
state copy was made.
The most recent state copy is removed from the state
stack and discarded, thus committing any changes made
to the object's state.
Writes the object's field data into the debugger
output window in VS.NET.
Implements n-level undo capabilities.
You should not directly derive from this class. Your
business classes should derive from
.
Allows us to mark DataPortal_xxx methods to
be run on the client even if the server-side
DataPortal is configured for remote use.
The primary purpose for this attribute is to
mark DataPortal_Create to run locally in the case
where we don't need to load default values
from the database as the object is being created.
By running DataPortal_Create locally we avoid all
the network overhead of going to the server for
no purpose.
Note that if you DO need to actually interact with
the database in your DataPortal_xxx method you SHOULD
NOT apply this attribute to your DataPortal_xxx method!
Also note that if you apply this attribute and the
Transactional attribute to the same method, you MUST
register the ServicedDataPortal DLL with COM+ on the
client machine or you'll get a runtime failure. The
exception to this is if the user is an administrator
on the client machine, in which case Enterprise Services
will automatically register the DLL with COM+.
Provides access to the name of the broken rule.
This value is actually readonly, not readwrite. Any new
value set into this property is ignored. The property is only
readwrite because that is required to support data binding
within Web Forms.
The name of the rule.
Provides access to the description of the broken rule.
This value is actually readonly, not readwrite. Any new
value set into this property is ignored. The property is only
readwrite because that is required to support data binding
within Web Forms.
The description of the rule.
Provides access to the property affected by the broken rule.
This value is actually readonly, not readwrite. Any new
value set into this property is ignored. The property is only
readwrite because that is required to support data binding
within Web Forms.
The property affected by the rule.
Stores details about a specific broken business rule.
Returns a object
containing details about a specific broken business rule.
Returns the first object
corresponding to the specified property.
When a rule is marked as broken, the business developer can provide
an optional Property parameter. This parameter is the name of the
Property on the object that is most affected by the rule. Data binding
may later use the IDataErrorInfo interface to query the object for
details about errors corresponding to specific properties, and this
value will be returned as a result of that query.
Code in a business object or UI can also use this value to retrieve
the first broken rule in that corresponds
to a specfic Property on the object.
The name of the property affected by the rule.
Prevents clearing the collection.
Prevents insertion of items into the collection.
Prevents removal of items from the collection.
Prevents changing items in the collection.
A collection of currently broken rules.
This collection is readonly and can be safely made available
to code outside the business object such as the UI. This allows
external code, such as a UI, to display the list of broken rules
to the user.
Sets the target object so the Rules Manager functionality
has a reference to the object containing the data to
be validated.
The object here is typically your business object. In your
business class you'll implement a method to set up your
business rules. As you do so, you need to call this method
to give BrokenRules a reference to your business object
so it has access to your object's data.
A reference to the object containing
the data to be validated.
Delegate that defines the method signature for all rule handler methods.
When implementing a rule handler, you must conform to the method signature
defined by this delegate. You should also apply the Description attribute
to your method to provide a meaningful description for your rule.
The method implementing the rule must return True if the data is valid and
return False if the data is invalid.
The (optional) name of the property to be validated.
Set by the rule handler method to describe the broken
rule.
If the rule handler sets this property, this value will override
any description attribute value associated with the rule handler
method.
The description string returned via this property
is provided to the UI or other consumer
about which rules are broken. These descriptions are intended
for end-user display.
The description value is a .NET format string, and it can include
the following tokens in addition to literal text:
{0} - the RuleName value
{1} - the PropertyName value
{2} - the full type name of the target object
{3} - the ToString value of the target object
You can use these tokens in your description string and the
appropriate values will be substituted for the tokens at
runtime.
Creates an instance of RuleArgs.
Creates an instance of RuleArgs.
The name of the property to be validated.
Returns an empty RuleArgs object.
Object providing extra information to methods that
implement business rules.
Initializes the attribute with a description.
Returns the description value of the attribute.
Defines the description of a business rule.
The description in this attribute is used by BusinessRules
as information that is provided to the UI or other consumer
about which rules are broken. These descriptions are intended
for end-user display.
The description value is a .NET format string, and it can include
the following tokens in addition to literal text:
{0} - the RuleName value
{1} - the PropertyName value
{2} - the full type name of the target object
{3} - the ToString value of the target object
You can use these tokens in your description string and the
appropriate values will be substituted for the tokens at
runtime.
Instead of using this attribute, a rule handler method can
set the Description property of the RuleArgs parameter to
a description string. That approach can provide a more dynamic
way to generate descriptions of broken rules.
Returns the name of the method implementing the rule
and the property, field or column name to which the
rule applies.
Returns the delegate to the method implementing the rule.
Returns the user-friendly name of the rule.
Returns the name of the field, property or column
to which the rule applies.
Returns the formatted description of the rule.
Retrieves the description text from the Description
attribute on a RuleHandler method.
Creates and initializes the rule.
Reference to the object containing the data to validate.
The address of the method implementing the rule.
The user-friendly name of the rule.
A RuleArgs object containing data related to the rule.
Creates and initializes the rule.
Reference to the object containing the data to validate.
The address of the method implementing the rule.
The user-friendly name of the rule.
The field, property or column to which the rule applies.
Invokes the rule to validate the data.
True if the data is valid, False if the data is invalid.
Tracks all information for a rule.
Returns the ArrayList containing rules for a rule name. If
no ArrayList exists one is created and returned.
Adds a rule to the list of rules to be enforced.
A rule is implemented by a method which conforms to the
method signature defined by the RuleHandler delegate.
The ruleName is used to group all the rules that apply
to a specific field, property or concept. All rules applying
to the field or property should have the same rule name. When
rules are checked, they can be checked globally or for a
specific ruleName.
The propertyName may be used by the method that implements the rule
in order to retrieve the value to be validated. If the rule
implementation is inside the target object then it probably has
direct access to all data. However, if the rule implementation
is outside the target object then it will need to use reflection
or CallByName to dynamically invoke this property to retrieve
the value to be validated.
The method that implements the rule.
A user-friendly identifier for the field/property
to which the rule applies.
Adds a rule to the list of rules to be enforced.
A rule is implemented by a method which conforms to the
method signature defined by the RuleHandler delegate.
The ruleName is used to group all the rules that apply
to a specific field, property or concept. All rules applying
to the field or property should have the same rule name. When
rules are checked, they can be checked globally or for a
specific ruleName.
The method that implements the rule.
A user-friendly identifier for the field/property
to which the rule applies.
A RuleArgs object containing data
to be passed to the method implementing the rule.
Adds a rule to the list of rules to be enforced.
A rule is implemented by a method which conforms to the
method signature defined by the RuleHandler delegate.
The ruleName is used to group all the rules that apply
to a specific field, property or concept. All rules applying
to the field or property should have the same rule name. When
rules are checked, they can be checked globally or for a
specific ruleName.
The propertyName may be used by the method that implements the rule
in order to retrieve the value to be validated. If the rule
implementation is inside the target object then it probably has
direct access to all data. However, if the rule implementation
is outside the target object then it will need to use reflection
or CallByName to dynamically invoke this property to retrieve
the value to be validated.
The method that implements the rule.
A user-friendly identifier for the field/property
to which the rule applies.
The property name on the target object where the rule implementation can retrieve
the value to be validated.
Checks all the rules for a specific ruleName.
The ruleName to be validated.
Checks all the rules for a target object.
This method is called by business logic within a business class to
indicate whether a business rule is broken.
Rules are identified by their names. The description field is merely a
comment that is used for display to the end user. When a rule is marked as
broken, it is recorded under the rule name value. To mark the rule as not
broken, the same rule name must be used.
The name of the business rule.
The description of the business rule.
True if the value is broken, False if it is not broken.
This method is called by business logic within a business class to
indicate whether a business rule is broken.
Rules are identified by their names. The description field is merely a
comment that is used for display to the end user. When a rule is marked as
broken, it is recorded under the rule name value. To mark the rule as not
broken, the same rule name must be used.
The name of the business rule.
The description of the business rule.
The property affected by the business rule.
True if the value is broken, False if it is not broken.
Returns a value indicating whether there are any broken rules
at this time. If there are broken rules, the business object
is assumed to be invalid and False is returned. If there are no
broken business rules True is returned.
A value indicating whether any rules are broken.
Returns a value indicating whether a particular business rule
is currently broken.
The name of the rule to check.
A value indicating whether the rule is currently broken.
Returns a reference to the readonly collection of broken
business rules.
The reference returned points to the actual collection object.
This means that as rules are marked broken or unbroken over time,
the underlying data will change. Because of this, the UI developer
can bind a display directly to this collection to get a dynamic
display of the broken rules at all times.
A reference to the collection of broken rules.
Returns the text of all broken rule descriptions, each
separated by cr/lf.
The text of all broken rule descriptions.
Tracks the business rules broken within a business object.
Initializes the SafeDataReader object to use data from
the provided DataReader object.
The source DataReader object containing the data.
Gets a string value from the datareader.
Returns empty string for null.
Gets a string value from the datareader.
Returns "" for null.
Gets a value of type from the datareader.
Returns Nothing for null.
Gets a value of type from the datareader.
Returns Nothing for null.
Gets an integer from the datareader.
Returns 0 for null.
Gets an integer from the datareader.
Returns 0 for null.
Gets a double from the datareader.
Returns 0 for null.
Gets a double from the datareader.
Returns 0 for null.
Gets a from the datareader.
A null is converted into the min possible date
See Chapter 5 for more details on the SmartDate class.
The column number within the datareader.
Gets a from the datareader.
A null is converted into either the min or max possible date
depending on the MinIsEmpty parameter. See Chapter 5 for more
details on the SmartDate class.
The column number within the datareader.
A flag indicating whether the min or max value of a data means an empty date.
Gets a Guid value from the datareader.
Gets a Guid value from the datareader.
Reads the next row of data from the datareader.
Moves to the next result set in the datareader.
Closes the datareader.
Returns the depth property value from the datareader.
Calls the Dispose method on the underlying datareader.
Returns the FieldCount property from the datareader.
Gets a boolean value from the datareader.
Gets a boolean value from the datareader.
Gets a byte value from the datareader.
Gets a byte value from the datareader.
Invokes the GetBytes method of the underlying datareader.
Invokes the GetBytes method of the underlying datareader.
Gets a char value from the datareader.
Gets a char value from the datareader.
Invokes the GetChars method of the underlying datareader.
Invokes the GetChars method of the underlying datareader.
Invokes the GetData method of the underlying datareader.
Invokes the GetData method of the underlying datareader.
Invokes the GetDataTypeName method of the underlying datareader.
Invokes the GetDataTypeName method of the underlying datareader.
Gets a date value from the datareader.
Gets a date value from the datareader.
Gets a decimal value from the datareader.
Gets a decimal value from the datareader.
Invokes the GetFieldType method of the underlying datareader.
Invokes the GetFieldType method of the underlying datareader.
Gets a Single value from the datareader.
Gets a Single value from the datareader.
Gets a Short value from the datareader.
Gets a Short value from the datareader.
Gets a Long value from the datareader.
Gets a Long value from the datareader.
Invokes the GetName method of the underlying datareader.
Gets an ordinal value from the datareader.
Invokes the GetSchemaTable method of the underlying datareader.
Invokes the GetValues method of the underlying datareader.
Returns the IsClosed property value from the datareader.
Invokes the IsDBNull method of the underlying datareader.
Invokes the IsDBNull method of the underlying datareader.
Returns a value from the datareader.
Returns Nothing if the value is null.
Returns a value from the datareader.
Returns Nothing if the value is null.
Returns the RecordsAffected property value from the underlying datareader.
This is a DataReader that 'fixes' any null values before
they are returned to our business code.
Fills the DataSet with data from an object or collection.
The name of the DataTable being filled is will be the class name of
the object acting as the data source. The
DataTable will be inserted if it doesn't already exist in the DataSet.
A reference to the DataSet to be filled.
A reference to the object or collection acting as a data source.
Fills the DataSet with data from an object or collection.
The name of the DataTable being filled is specified as a parameter. The
DataTable will be inserted if it doesn't already exist in the DataSet.
A reference to the DataSet to be filled.
A reference to the object or collection acting as a data source.
Fills a DataTable with data values from an object or collection.
A reference to the DataTable to be filled.
A reference to the object or collection acting as a data source.
An ObjectAdapter is used to convert data in an object
or collection into a DataTable.
Returns True if this is a new object, False if it is a pre-existing object.
An object is considered to be new if its data doesn't correspond to
data in the database. In other words, if the data values in this particular
object have not yet been saved to the database the object is considered to
be new. Likewise, if the object's data has been deleted from the database
then the object is considered to be new.
A value indicating if this object is new.
Returns True if this object is marked for deletion.
CSLA .NET supports both immediate and deferred deletion of objects. This
property is part of the support for deferred deletion, where an object
can be marked for deletion, but isn't actually deleted until the object
is saved to the database. This property indicates whether or not the
current object has been marked for deletion. If it is True, the object will
be deleted when it is saved to the database, otherwise it will be inserted
or updated by the save operation.
A value indicating if this object is marked for deletion.
Returns True if this object's data has been changed.
When an object's data is changed, CSLA .NET makes note of that change
and considers the object to be 'dirty' or changed. This value is used to
optimize data updates, since an unchanged object does not need to be
updated into the database. All new objects are considered dirty. All objects
marked for deletion are considered dirty.
Once an object's data has been saved to the database (inserted or updated)
the dirty flag is cleared and the object is considered unchanged. Objects
newly loaded from the database are also considered unchanged.
A value indicating if this object's data has been changed.
Marks the object as being a new object. This also marks the object
as being dirty and ensures that it is not marked for deletion.
Newly created objects are marked new by default. You should call
this method in the implementation of DataPortal_Update when the
object is deleted (due to being marked for deletion) to indicate
that the object no longer reflects data in the database.
Marks the object as being an old (not new) object. This also
marks the object as being unchanged (not dirty).
You should call this method in the implementation of
DataPortal_Fetch to indicate that an existing object has been
successfully retrieved from the database.
You should call this method in the implementation of
DataPortal_Update to indicate that a new object has been successfully
inserted into the database.
Marks an object for deletion. This also marks the object
as being dirty.
You should call this method in your business logic in the
case that you want to have the object deleted when it is
saved to the database.
Marks an object as being dirty, or changed.
You should call this method in your business logic any time
the object's internal data changes. Any time any instance
variable changes within the object, this method should be called
to tell CSLA .NET that the object's data has been changed.
Marking an object as dirty does two things. First it ensures
that CSLA .NET will properly save the object as appropriate. Second,
it causes CSLA .NET to tell Windows Forms data binding that the
object's data has changed so any bound controls will update to
reflect the new values.
Returns True if this object is both dirty and valid.
An object is considered dirty (changed) if
returns True. It is
considered valid if
returns True. The IsSavable property is
a combination of these two properties. It is provided specifically to
enable easy binding to a Save or OK button on a form so that button
can automatically enable/disable as the object's state changes between
being savable and not savable.
A value indicating if this object is new.
Used by as a
child object is created to tell the child object about its
parent.
A reference to the parent collection object.
Allow data binding to start a nested edit on the object.
Data binding may call this method many times. Only the first
call should be honored, so we have extra code to detect this
and do nothing for subsquent calls.
Allow data binding to cancel the current edit.
Data binding may call this method many times. Only the first
call to either IEditableObject.CancelEdit or
IEditableObject.EndEdit
should be honored. We include extra code to detect this and do
nothing for subsequent calls.
Allow data binding to apply the current edit.
Data binding may call this method many times. Only the first
call to either IEditableObject.EndEdit or
IEditableObject.CancelEdit
should be honored. We include extra code to detect this and do
nothing for subsequent calls.
Starts a nested edit on the object.
When this method is called the object takes a snapshot of
its current state (the values of its variables). This snapshot
can be restored by calling
or committed by calling .
This is a nested operation. Each call to BeginEdit adds a new
snapshot of the object's state to a stack. You should ensure that
for each call to BeginEdit there is a corresponding call to either
CancelEdit or ApplyEdit to remove that snapshot from the stack.
See Chapters 2 and 4 for details on n-level undo and state stacking.
Cancels the current edit process, restoring the object's state to
its previous values.
Calling this method causes the most recently taken snapshot of the
object's state to be restored. This resets the object's values
to the point of the last
call.
Commits the current edit process.
Calling this method causes the most recently taken snapshot of the
object's state to be discarded, thus committing any changes made
to the object's state since the last
call.
Marks the object as being a child object.
By default all business objects are 'parent' objects. This means
that they can be directly retrieved and updated into the database.
We often also need child objects. These are objects which are contained
within other objects. For instance, a parent Invoice object will contain
child LineItem objects.
To create a child object, the MarkAsChild method must be called as the
object is created. Please see Chapter 7 for details on the use of the
MarkAsChild method.
Marks the object for deletion. The object will be deleted as part of the
next save operation.
CSLA .NET supports both immediate and deferred deletion of objects. This
method is part of the support for deferred deletion, where an object
can be marked for deletion, but isn't actually deleted until the object
is saved to the database. This method is called by the UI developer to
mark the object for deletion.
To 'undelete' an object, use before
calling the Delete method. You can then use
later to reset the object's state to its original values. This will include resetting
the deleted flag to False.
Creates a clone of the object.
A new object containing the exact data of the original object.
Override this method in your business class to
be notified when you need to set up business
rules.
You should call AddBusinessRules from your object's
constructor methods so the rules are set up when
your object is created. This method will be automatically
called, if needed, when your object is serialized by
the DataPortal or by the Clone method.
Returns True if the object is currently valid, False if the
object has broken rules or is otherwise invalid.
By default this property relies on the underling
object to track whether any business rules are currently broken for this object.
You can override this property to provide more sophisticated
implementations of the behavior. For instance, you should always override
this method if your object has child objects, since the validity of this object
is affected by the validity of all child objects.
A value indicating if the object is currently valid.
Provides access to the readonly collection of broken business rules
for this object.
A object.
Provides access to a text representation of all the descriptions of
the currently broken business rules for this object.
Text containing the descriptions of the broken business rules.
Provides access to the broken rules functionality.
This property is used within your business logic so you can
easily call the
method to mark rules as broken and unbroken.
Provides access to the broken rules as a single string
AyaNova - Provides access to a single string containing broken rules text
for easier binding to single text display rather than lists as in default
implementation
Saves the object to the database.
Calling this method starts the save operation, causing the object
to be inserted, updated or deleted within the database based on the
object's current state.
If is True the object
will be deleted. Otherwise, if
is True the object will be inserted. Otherwise the object's data will
be updated in the database.
All this is contingent on . If
this value is False, no data operation occurs. It is also contingent on
. If this value is False an
exception will be thrown to indicate that the UI attempted to save an
invalid object.
It is important to note that this method returns a new version of the
business object that contains any data updated during the save operation.
You MUST update all object references to use this new version of the
business object in order to have access to the correct object data.
You can override this method to add your own custom behaviors to the save
operation. For instance, you may add some security checks to make sure
the user can save the object. If all security checks pass, you would then
invoke the base Save method via MyBase.Save().
A new object containing the saved values.
Override this method to load a new business object with default
values from the database.
An object containing criteria values.
Override this method to allow retrieval of an existing business
object based on data in the database.
An object containing criteria values to identify the object.
Override this method to allow insert, update or deletion of a business
object.
Override this method to allow immediate deletion of a business object.
An object containing criteria values to identify the object.
Returns the specified database connection string from the application
configuration file.
The database connection string must be in the appSettings section
of the application configuration file. The database name should be
prefixed with 'DB:'. For instance, DB:mydatabase.
Name of the database.
A database connection string.
This method is called on a newly deserialized object
after deserialization is complete.
This method is called on the original instance of the
object after it has been serialized.
This method is called before an object is serialized.
This is the base class from which most business objects
will be derived.
This class is the core of the CSLA .NET framework. To create
a business object, inherit from this class.
Please refer to 'Expert One-on-One VB.NET Business Objects' for
full details on the use of this base class to create business
objects.
/
Return a user's security access level
to given item referenced in passed in string
User ID property
IsGenerator property
User Language property
Index method property
Use Notification property
Flag - true = remote dataportal, false=direct db connection
Used for diagnostics purposes so any code remote
or local can know if a remote data portal is in use
or a direct database connection
Implements the Identity property defined by IPrincipal.
Implements the IsInRole property defined by IPrincipal.
ReWritten for AyaNova to not do anything
Initiates a login process using custom CSLA .NET security.
As described in the book, this invokes a login process using
a table-based authentication scheme and a list of roles in
the database tables. By replacing the code in
you can easily
adapt this scheme to authenticate the user against any database
or other scheme.
The user's username.
The user's password.
Implements a custom Principal class that is used by
CSLA .NET for table-based security.
Called by a factory method in a business class to create
a new object, which is loaded with default
values from the database.
Object-specific criteria.
A new object, populated with default values.
Called by a factory method in a business class to retrieve
an object, which is loaded with values from the database.
Object-specific criteria.
An object populated with values from the database.
Called by the method to
insert, update or delete an object in the database.
Note that this method returns a reference to the updated business object.
If the server-side DataPortal is running remotely, this will be a new and
different object from the original, and all object references MUST be updated
to use this new object.
A reference to the business object to be updated.
A reference to the updated business object.
Called by a Shared method in the business class to cause
immediate deletion of a specific object from the database.
Object-specific criteria.
This is the client-side DataPortal as described in
Chapter 5.
Initializes a new instance of the
class.
Initializes a new instance of the
class
with a specified error message.
Initializes a new instance of the
class
with a specified error message and a reference to the
inner exception that is the cause of this exception.
Initializes a new instance of the
class
with serialized data.
Exception class indicating that there was a validation
problem with a business object.
Allows us to mark fields that should not be copied as part of the undo process
Marking a variable with this attribute will cause the n-level
undo process to ignore that variable's value. The value will
not be included in a snapshot when BeginEdit is called, nor
will it be restored when CancelEdit is called.
Allows us to mark the DataPortal_xxx methods in our business
classes as transactional.
When a method is marked as transactional, the DataPortal
mechanism runs the method within a COM+ transactional
context, so the data access is protected by a 2-phase
distributed transaction.
Rights property.
Right - return a user right based on passed in rights string
User ID property
IsGenerator property
User language property
Index method property
Notification property
Flag - true = remote dataportal, false=direct db connection
Used for diagnostics purposes so any code remote
or local can know if a remote data portal is in use
or a direct database connection
Implements the IsAuthenticated property defined by IIdentity.
Implements the AuthenticationType property defined by IIdentity.
Implements the Name property defined by IIdentity.
Retrieves the identity data for a specific user.
Implements a custom Identity class that supports
CSLA .NET data access via the DataPortal.
Used to see if the collection contains a specific child object.
Only the 'active' list of child objects is checked.
Business collections also contain deleted objects, which are
not checked by this call.
A reference to the object.
True if the collection contains the object.
Used to see if the collection contains a reference to a
child object that is marked for deletion.
This scans the list of child objects that have been marked
for deletion. If this object is in that list, the method
returns True.
A reference to the object.
True if the collection contains the object.
Returns True if this object's data has been changed.
When an object's data is changed, CSLA .NET makes note of that change
and considers the object to be 'dirty' or changed. This value is used to
optimize data updates, since an unchanged object does not need to be
updated into the database. All new objects are considered dirty. All objects
marked for deletion are considered dirty.
Once an object's data has been saved to the database (inserted or updated)
the dirty flag is cleared and the object is considered unchanged. Objects
newly loaded from the database are also considered unchanged.
If any child object within the collection is dirty then the collection
is considered to be dirty. If all child objects are unchanged, then the
collection is not dirty.
A value indicating if this object's data has been changed.
Returns True if the object is currently valid, False if the
object has broken rules or is otherwise invalid.
By default this property relies on the underling
object to track whether any business rules are currently broken for this object.
You can override this property to provide more sophisticated
implementations of the behavior. For instance, you should always override
this method if your object has child objects, since the validity of this object
is affected by the validity of all child objects.
If any child object within the collection is invalid then the collection
is considered to be invalid. If all child objects are valid, then the
collection is valid.
A value indicating if the object is currently valid.
Returns True if this object is both dirty and valid.
An object is considered dirty (changed) if
returns True. It is
considered valid if
returns True. The IsSavable property is
a combination of these two properties. It is provided specifically to
enable easy binding to a Save or OK button on a form so that button
can automatically enable/disable as the object's state changes between
being savable and not savable.
A value indicating if this object is new.
Starts a nested edit on the object.
When this method is called the object takes a snapshot of
its current state (the values of its variables). This snapshot
can be restored by calling
or committed by calling .
This is a nested operation. Each call to BeginEdit adds a new
snapshot of the object's state to a stack. You should ensure that
for each call to BeginEdit there is a corresponding call to either
CancelEdit or ApplyEdit to remove that snapshot from the stack.
See Chapters 2 and 4 for details on n-level undo and state stacking.
This method triggers the copying of all child object states.
Cancels the current edit process, restoring the object's state to
its previous values.
Calling this method causes the most recently taken snapshot of the
object's state to be restored. This resets the object's values
to the point of the last
call.
This method triggers an undo in all child objects.
Commits the current edit process.
Calling this method causes the most recently taken snapshot of the
object's state to be discarded, thus committing any changes made
to the object's state since the last
call.
This method triggers an ApplyEdit in all child objects.
A collection containing all child objects marked
for deletion.
Adds a child object to the collection.
The child object to be added.
Removes a child object from the collection.
The child object to be removed.
Returns a reference to a child object in the collection.
The positional index of the item in the collection.
The specified child object.
Defines a strongly-typed collection to store all
child objects marked for deletion.
This method is called by a child object when it
wants to be removed from the collection.
The child object to remove.
Sets the edit level of the child object as it is added.
Marks the child object for deletion and moves it to
the collection of deleted objects.
Marks all child objects for deletion and moves them
to the collection of deleted objects.
Indicates whether this collection object is a child object.
True if this is a child object.
Marks the object as being a child object.
By default all business objects are 'parent' objects. This means
that they can be directly retrieved and updated into the database.
We often also need child objects. These are objects which are contained
within other objects. For instance, a parent Invoice object will contain
child LineItem objects.
To create a child object, the MarkAsChild method must be called as the
object is created. Please see Chapter 7 for details on the use of the
MarkAsChild method.
Creates a clone of the object.
A new object containing the exact data of the original object.
Saves the object to the database.
Calling this method starts the save operation, causing the all child
objects to be inserted, updated or deleted within the database based on the
each object's current state.
All this is contingent on . If
this value is False, no data operation occurs. It is also contingent on
. If this value is False an
exception will be thrown to indicate that the UI attempted to save an
invalid object.
It is important to note that this method returns a new version of the
business collection that contains any data updated during the save operation.
You MUST update all object references to use this new version of the
business collection in order to have access to the correct object data.
You can override this method to add your own custom behaviors to the save
operation. For instance, you may add some security checks to make sure
the user can save the object. If all security checks pass, you would then
invoke the base Save method via MyBase.Save().
A new object containing the saved values.
Override this method to load a new business object with default
values from the database.
An object containing criteria values.
Override this method to allow retrieval of an existing business
object based on data in the database.
An object containing criteria values to identify the object.
Override this method to allow insert, update or deletion of a business
object.
Override this method to allow immediate deletion of a business object.
An object containing criteria values to identify the object.
Returns the specified database connection string from the application
configuration file.
The database connection string must be in the appSettings section
of the application configuration file. The database name should be
prefixed with 'DB:'. For instance, DB:mydatabase.
Name of the database.
A database connection string.
This method is called on a newly deserialized object
after deserialization is complete.
This method is called on the original instance of the
object after it has been serialized.
This method is called before an object is serialized.
This is the base class from which most business collection
objects will be derived.
To create a collection of business objects, inherit from this
class. The business objects contained in this collection must
inherit from , and the objects
must be marked as child objects.
Please refer to 'Expert One-on-One VB.NET Business Objects' for
full details on the use of this base class to create business
collections.
Creates a new ReadOnlyCollectionBase object.
Indicates that the collection is locked, so insert, remove
and change operations are disallowed.
Prevents insertion of new items into the collection when the
collection is locked.
Prevents removal of items from the collection when the
collection is locked.
Prevents clearing the collection when the
collection is locked.
Prevents changing an item reference when the
collection is locked.
Creates a clone of the object.
A new object containing the exact data of the original object.
Override this method to allow retrieval of an existing business
object based on data in the database.
An object containing criteria values to identify the object.
Returns the specified database connection string from the application
configuration file.
The database connection string must be in the appSettings section
of the application configuration file. The database name should be
prefixed with 'DB:'. For instance, DB:mydatabase.
Name of the database.
A database connection string.
This method is called on a newly deserialized object
after deserialization is complete.
This method is called on the original instance of the
object after it has been serialized.
This method is called before an object is serialized.
This is the base class from which readonly collections
of readonly objects should be derived.
Creates a new SmartDate object.
The SmartDate created will use the min possible
date to represent an empty date.
Creates a new SmartDate object.
Indicates whether an empty date is the min or max date value.
Creates a new SmartDate object.
The SmartDate created will use the min possible
date to represent an empty date.
The initial value of the object.
Creates a new SmartDate object.
The initial value of the object.
Indicates whether an empty date is the min or max date value.
Creates a new SmartDate object.
The SmartDate created will use the min possible
date to represent an empty date.
The initial value of the object (as text).
Creates a new SmartDate object.
The initial value of the object (as text).
Indicates whether an empty date is the min or max date value.
Gets or sets the format string used to format a date
value when it is returned as text.
The format string should follow the requirements for the
Visual Basic .NET Format() statement.
A format string.
Gets or sets the date value.
This property can be used to set the date value by passing a
text representation of the date. Any text date representation
that can be parsed by the .NET runtime is valid.
When the date value is retrieved via this property, the text
is formatted by using the format specified by the
property. The default is the
"Short Date" format.
Gets or sets the date value.
Returns a text representation of the date value.
Returns True if the objects are equal.
Returns True if the object is equal to this SmartDate.
Returns True if the SmartDate is equal to this SmartDate.
Returns True if the date is equal to this SmartDate.
Returns True if the text (as a date) is equal to this SmartDate.
Returns a hash code for this object.
Gets / Sets a database-friendly version of the date value.
If the SmartDate contains an empty date, this returns DBNull. Otherwise
the actual date value is returned as type Date.
This property is very useful when setting parameter values for
a Command object, since it automatically stores null values into
the database for empty date values.
When you also use the SafeDataReader and its GetSmartDate method,
you can easily read a null value from the database back into a
SmartDate object so it remains considered as an empty date value.
Indicates whether this object contains an empty date.
True if the date is empty.
Indicates whether an empty date is the min or max possible date value.
Whether an empty date is considered to be the smallest or largest possible
date is only important for comparison operations. This allows you to
compare an empty date with a real date and get a meaningful result.
True if an empty date is the smallest date, False if it is the largest.
Converts a text date representation into a Date value.
An empty string is assumed to represent an empty date. An empty date
is returned as the MinValue of the Date datatype.
The text representation of the date.
A Date value.
Converts a text date representation into a Date value.
An empty string is assumed to represent an empty date. An empty date
is returned as the MinValue or MaxValue of the Date datatype depending
on the EmptyIsMin parameter.
The text representation of the date.
Indicates whether an empty date is the min or max date value.
A Date value.
Converts a date value into a text representation.
The date is considered empty if it matches the min value for
the Date datatype. If the date is empty, this
method returns an empty string. Otherwise it returns the date
value formatted based on the FormatString parameter.
The date value to convert.
The format string used to format the date into text.
Text representation of the date value.
Converts a date value into a text representation.
Whether the date value is considered empty is determined by
the EmptyIsMin parameter value. If the date is empty, this
method returns an empty string. Otherwise it returns the date
value formatted based on the FormatString parameter.
The date value to convert.
The format string used to format the date into text.
Indicates whether an empty date is the min or max date value.
Text representation of the date value.
Compares one SmartDate to another.
This method works the same as the CompareTo method
on the Date datetype, with the exception that it
understands the concept of empty date values.
The date to which we are being compared.
A value indicating if the comparison date is less than, equal to or greater than this date.
Compares one SmartDate to another.
This method works the same as the CompareTo method
on the Date datetype, with the exception that it
understands the concept of empty date values.
The date to which we are being compared.
A value indicating if the comparison date is less than, equal to or greater than this date.
Compares a SmartDate to a text date value.
The date to which we are being compared.
A value indicating if the comparison date is less than, equal to or greater than this date.
Compares a SmartDate to a date value.
The date to which we are being compared.
A value indicating if the comparison date is less than, equal to or greater than this date.
Adds a TimeSpan onto the object.
Subtracts a TimeSpan from the object.
Provides a date data type that understands the concept
of an empty date value.
See Chapter 5 for a full discussion of the need for this
data type and the design choices behind it.
Creates a clone of the object.
A new object containing the exact data of the original object.
Override this method to allow retrieval of an existing business
object based on data in the database.
An object containing criteria values to identify the object.
Returns the specified database connection string from the application
configuration file.
The database connection string must be in the appSettings section
of the application configuration file. The database name should be
prefixed with 'DB:'. For instance, DB:mydatabase.
Name of the database.
A database connection string.
This method is called on a newly deserialized object
after deserialization is complete.
This method is called on the original instance of the
object after it has been serialized.
This method is called before an object is serialized.
This is a base class from which readonly business classes
can be derived.
This base class only supports data retrieve, not updating or
deleting. Any business classes derived from this base class
should only implement readonly properties.
Creates a clone of the object.
A new object containing the exact data of the original object.
Returns a value from the list.
The positional index of the value in the collection.
The specified value.
Returns a value from the list.
The name of the value.
The specified value.
Adds a name/value pair to the list.
The name of the item.
The value to be added.
Returns the first name found in the list with the specified
value.
This method throws an exception if no matching value is found
in the list.
The value to search for in the list.
The name of the item found.
Creates a new NameValueList.
Creates a new NameValueList.
Override this method to allow retrieval of an existing business
object based on data in the database.
In many cases you can call the SimpleFetch method to
retrieve simple name/value data from a single table in
a database. In more complex cases you may need to implement
your own data retrieval code using ADO.NET.
An object containing criteria values to identify the object.
Returns the specified database connection string from the application
configuration file.
The database connection string must be in the appSettings section
of the application configuration file. The database name should be
prefixed with 'DB:'. For instance, DB:mydatabase.
Name of the database.
A database connection string.
Provides default/simple loading for most lists.
It is called to load data from the database
The DAL database to read
The name of the table to read.
The name of the column containing name or key values.
The name of the column containing data values.
Provides default/simple loading for most lists.
It is called to load data from the database
Customized by JOHN - Modified version to deal with GUID as id column
The DAL database to read
The name of the table to read.
The name of the column containing name or key values.
The name of the column containing data values.
Same as SimpleFetchG, but only loads records with Active=true
Provides default/simple loading for most lists.
It is called to load data from the database
Customized by JOHN - Modified version to deal with GUID as id column
The DAL database to read
The name of the table to read.
The name of the column containing name or key values.
The name of the column containing data values.
Loads name value list based on passed sql query text
Customized by JOHN - Modified version to deal with GUID as id column
and to allow passing in a string to specify sql
The DAL database to read
The sql query to run. **MUST return the name as the first parameter
And a GUID value as the second parameter, anything else is indeterminate
Loads name value list based on passed sql query text
Customized by JOHN - to allow passing in a string to specify sql
The DAL database to read
The sql query to run. **MUST return the name as the first parameter
And a string value as the second parameter, anything else is indeterminate
This is a base class from which readonly name/value
business classes can be quickly and easily created.
As discussed in Chapter 5, inherit from this class to
quickly and easily create name/value list objects for
population of ListBox or ComboBox controls and for
validation of list-based data items in your business
objects.
Indicates whether the collection is in the process of
being sorted at this time.
Returns a value indicating whether the collection is currently
sorted.
Returns the property by which the collection is currently sorted.
This method is invoked via the IBindingList interface and is not
intended for use by code in your business class.
Returns the current sort direction.
This method is invoked via the IBindingList interface and is not
intended for use by code in your business class.
Structure to store temporary data for sorting.
Contains code to compare SortData structures
This performs a case sensitive comparison. If you want a case insensitive
comparison, change the code to use CaseInsensitiveComparer.Default instead.
Applies a sort to the collection.
This method is invoked via the IBindingList interface and is not
intended for use by code in your business class.
Removes any sort from the collection.
This method is invoked via the IBindingList interface and is not
intended for use by code in your business class.
Ensures that any sort is maintained as a new item is inserted.
Ensures that any sort is maintained as the list is cleared.
Ensures that any sort is maintained as an item is removed.
Implements search/find functionality for the collection.
This class implements sorting functionality for collections.
This class inhirits from Core.BindableCollectionBase and adds
sorting capability to collections. BusinessCollectionBase inherits
from this class, and business collections should inherit from
BusinessCollectionBase. Core.SortedCollectionBase is for internal
framework use only.
The Core.BindableCollectionBase class implements the IBindableList
interface. However, it doesn't actually implement sorting. Instead
it delegates the sorting functionality to a set of protected virtual
methods. This class provides the actual sorting implementation
by overriding those methods.