My favorites | Sign in
Logo
                
Search
for
Updated Nov 11, 2007 by uooopaa
ActiveRecordAndDetachedQuery  
ActiveRecord with support for DetachedQuery

Introduction

Our implementation for IDetachedQuery let the posibility for use this classes in everywhere. Then this are our implementation of 4 important classes at ActiveRecord Project: ActiveRecordBase, ActiveRecordBase<T>, ActiveRecordValidationBase and ActiveRecordValidationBase<T>

Details

If we want support for IDetachedQuery using ActiveRecord you must this clases:

  • ActiveRecordBase
  • ActiveRecordBase<T>
  • ActiveRecordValidationBase
  • and ActiveRecordValidationBase<T>

Now you will able to do somethings like this:

Customer[] customers = Customer.FindAll(new DetachedQuery("from Customer Order By Name"));

The new methods for ActiveRecordBase and ActiveRecordValidationBase are:

    public static bool Exists(Type targetType, IDetachedQuery detachedQuery);
    public static Array FindAll(Type targetType, IDetachedQuery detachedQuery);
    public static object FindFirst(Type targetType, IDetachedQuery detachedQuery);
    public static object FindOne(Type targetType, IDetachedQuery detachedQuery);
    public static Array SlicedFindAll(Type targetType, int firstResult, int maxResults, IDetachedQuery detachedQuery);

And the new methods for ActiveRecordBase<T> and ActiveRecordValidationBase<T> are:

    public static bool Exists(IDetachedQuery detachedQuery);
    public static T[] FindAll(IDetachedQuery detachedQuery);
    public static T FindFirst(IDetachedQuery detachedQuery);
    public static T FindOne(IDetachedQuery detachedQuery);
    public static T[] SlicedFindAll(int firstResult, int maxResults, IDetachedQuery detachedQuery);

This implementation no hide any feature of ActiveRecord base classes, it's a extension for IDetachedQuery support.

Requeriments

This classes are provided in the assembly uNHAddIns.ActiveRecord.dll. And this assembly require the main assembly of the project: uNHAddIns.dll.

-- Dario Quintana


Sign in to add a comment
Hosted by Google Code