Hi,
I need some help in understanding this issue. I'm using the repository
pattern with ActiveRecordMediator. I've enabled the session scope http
module, marked my classes with the ActiveRecord(Lazy = true).
The problem is that each time I perform a FindAll or SlicedFindAll,
the mediator returns a collection of initialized elements instead of
proxies. Could someone point me out in the right direction?
This is my repository:
public interface IEntityRepository<TEntity>
{
IList<TEntity> FindAll(int page, int pageSize, out int
resultCount);
}
public class EntityRepository<TEntity> : IEntityRepository<TEntity>{
public virtual IList<TEntity> FindAll(int page, int pageSize)
{
return
(IList<TEntity>)ActiveRecordMediator.SlicedFindAll(typeof(TEntity),
(page * pageSize), pageSize);
}
}
[ActiveRecord(Lazy = true)]
public class DocumentEntity
{
private Guid _id;
private IList<DocumentVersionEntity> _versions;
[PrimaryKey(PrimaryKeyType.GuidComb, "Id")]
public virtual Guid Id
{
get { return _id; }
set { _id = value; }
}
[HasAndBelongsToMany(typeof(DocumentVersionEntity),
RelationType.Bag, Table = DocumentEntriesToDocumentVersions",
ColumnKey = "DocumentEntryId",
ColumnRef = "DocumentVersionId", Cascade
= ManyRelationCascadeEnum.AllDeleteOrphan, Lazy = true)]
public virtual IList<DocumentVersionEntity> Versions
{
get { return _versions; }
set { _versions = value; }
}
}
[ActiveRecord(Lazy = true)]
public class DocumentVersionEntity
{
private Guid _id;
[PrimaryKey(PrimaryKeyType.GuidComb, "Id")]
public virtual Guid Id
{
get { return _id; }
set { _id = value; }
}
}
When I execute the FindAll method, all the objects in the Versions
array of the DocumentEntity are DocumentVersionEntity instead of
DocumentVersionEntityProxy and are all intialized.
What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.