私はこの問題を理解するのに助けが必要です。私はActiveRecordMediatorでリポジトリ パターンを使用しています。私はセッションスコープhttp モジュールを有効にしました。私のクラスにはActiveRecord(Lazy = true)とマークされています。城ActiveRecordレイジーローディングNOT Working
問題は、FindAllまたはSlicedFindAllを実行するたびに、メディエータが 代理の代わりに初期化された要素のコレクションを返すということです。誰かが私を正しい方向に向けることができますか?
これは私のリポジトリです:私はFindAllメソッドを実行すると
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; }
}
}
}
は、DocumentEntityのバージョン アレイ内のすべてのオブジェクトではなく DocumentVersionEntityProxyのDocumentVersionEntityであり、すべてのintializedです。
私は間違っていますか?
あなたがManyRelationCascadeEnum.AllDeleteOrphanに設定し、あなたのカスケードの振る舞いを持って、次のコードで
クロス投稿(回答あり):http://groups.google.com/group/castle-project-users/browse_thread/thread/863f02fbc6ba52e8 –
私はキャッスルプロジェクトグループにも聞くことができると思いました。それでも、私の場合は答えはありません。 –