0

devforce 7.2.2 を使用すると、relatedentitylist にバグがあると思います。

シナリオ : 関連エンティティ リストの 1 つを含むエンティティをロードする RPC メソッドを呼び出します。子コレクションのアイテムの 1 つを削除してから、データをリロードします。デフォルトの QueryStrategy を使用すると、削除されたエンティティが relatedentitylist に表示されないことが予想されます。しかし、そこには削除済みの状態があります。

この動作は予期されたものですか?

[AllowRpc]
public static void DoStuff(IPrincipal principal, EntityManager entityManager, params Object[] args)
{
    var id = (int)args[0];

    // Load of one EntityA and his RelatedEntityList of EntityB
    var queryEntitiesA = new EntityQuery<EntityA>().With(entityManager).Include(EntityA.EntityPropertyNames.EntitiesB);
    var entityA = queryEntitiesA.FirstOrDefault(m => m.Id == id);

    // Count == 3
    var count = entityA.EntitiesB.Count(); 

    // Delete of one specific EntityB of the collection
    var entityB = queryEntitiesA.EntitiesB.FirstOrDefault(md => md.Type == 1);
    entityB.EntityFacts.Delete();

    // Now Count == 2
    count = entityA.EntitiesB.Count(); 

    // Reexcution of the query with a new condition which include the EntityA previously loaded
    var entities = queryEntitiesA.Where(p => "condition including the deleted entity").OrderBy(m => m.Date).Execute().ToList();

    // Now the collection is back with a count of 3, including the deleted EntityB. The state of the entity is Deleted
    count = entityA.EntitiesB.Count(); 
}
4

1 に答える 1