Castle.MonoRail.ActiveRecordSupport
Base class for all paginable queries, including custom ones.
Extenders should override the .
Optionally, the methods
and can also be overriden.
Pendent
Implementors should execute a query
to return the record count
Executes a query to return the record count
Returns the page items.
Actually, the implementation just sets the protected fields
and ,
gets an from SessionFactoryHolder
and calls in order to execute
the custom query and fetch only the page items.
The page size
The current page
The page items
The implementation of the method,
as required by .
Should not be overriden.
The NHibernate Session
The query results.
The implementation of the method,
as required by .
Should not be overriden.
The NHibernate Session
The query results.
For internal use only.
Should be overriden to return the custom HQL to be ran.
The custom HQL to be ran
May be overriden, in order to set custom query parameters.
The query
Override to provide a custom query execution.
The default behaviour is to just call .
The query
The query results.
A paginable criteria.
Mimics the interface.
Implementors should execute a query
to return the record count
This needs a performance boost. Couldn't think of a better
way of get the count.
Performs a simple query and paginate the results.
There's no need to supply a returnType, like in
, as we do not perform the
conversion of the query results to an array.
Pendent
Paginates using an
Paginates using an
Paginates using an
Paginates using the specified .
Pendent
Defines the behavior of
Autoload feature on
Means that no autoload should be performed on the target
type or on nested types.
Means that autoload should be used for the target type
and the nested types (if present). This demands that
the primary key be present on the http request
Does not load the root type, but loads nested types
if the primary key is present. If not present, sets null on nested type.
Means that we should autoload, but if the key is
invalid, like null, 0 or an empty string, then just
create a new instance of the target type.
Means that we should autoload target and nested types when the key is valid.
If the key is invalid, like null, 0 or an empty string, and the
instance is the root instance, then create a new instance of the target type.
If the key is invalid, and it's a nested instance, then set null on the nested type.
Means that we should autoload, but if the key is
invalid, like null, 0 or an empty string, then just
return null
Extends with
ActiveRecord specific functionallity
Defines a binder for the parameter
using the and the
specified prefix.
This uses the default
whic is
A name that prefixes the entries on the http request
Defines a binder for the parameter
using the and the
specified prefix.
A name that prefixes the entries on the http request
The predefined behavior the autoload feature should use
Defines the behavior the autoload feature
should use
Gets or sets the names of the collection that are expected to be binded.
If the binder does not find any value to an expected collection, it will clear to collection.
The expect collections names, in a csv fashion.
Extends class with some
ActiveRecord specific functionality.
Autoload can be turned on on the parameter, see .
for joined subclasses HasAndBelongsToMany properties doesn't include the ones of the parent class
so we need to check them recursively
for joined subclasses HasMany properties doesn't include the ones of the parent class
so we need to check them recursively
for joined subclasses BelongsTo properties doesn't include the ones of the parent class
so we need to check them recursively
Gets or sets a value indicating if the changes should be persisted.
true if the changes should be persisted; otherwise, false.
Gets or sets the .
The auto load behavior.
Gets the current AR model.
The current AR model.
Mark a parameter with this attribute to instruct the
to load an ActiveRecord instance of the parameter type, using the request parameter
as the identifier.
The only loads an instance
based on the primary key value obtained from
For example:
public class CustomerController : ARSmartDispatcherController
{
public void UpdateCustomerLocation([ARFetch("customer.id")] Customer customer, [ARFetch("location.id")] Location location)
{
customer.Location = location;
customer.Save();
RedirectToAction("index");
}
}
The code above assumes that you have the fields
customer.id and location.id on the form being
submitted.
Constructs an
specifying the parameter name and the create and require behavior
The parameter name to be read from the request
true if you want an instance even when the record is not found
true if you want an exception if the record is not found
Constructs an using the
parameter name as the
Constructs an specifing the
parameter name
Constructs an using the
parameter name as the
and the create and require behavior
true if you want an instance even when the record is not found
true if you want an exception if the record is not found
The parameter name to be read from the request. The parameter value will
be used as the primary key value to load the target object instance.
When set to true an instance of
the target type will be created if the record
is not found. The default is false.
When set to true, an exception will be thrown
if the record specified is not found. The default is false.
Comma-separated list of lazy associations to eager-fetch, when loading the ActiveRecord object.
Class responsible on loading records for parameters marked with the .
Extends the
with ActiveRecord specific functionality
Initializes a new instance of the class.
Binds the object using the posted values.
Defines where the parameters should be obtained from.
Type of the target.
The prefix.
The excluded properties.
The allowed properties.
The auto load behavior.
Binds the object.
Defines where the parameters should be obtained from.
Type of the target.
The prefix.
The auto load behavior.