You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Christopher DeGuise <ch...@be-pragmatic.com> on 2008/06/17 19:18:55 UTC
IBATIS.NET change proposal
Hi All,
I would like to alter how aggregate containers are returned from the cache.
The essential issues is that the aggregate container that is returned from
the cache is the same container that is cached. Thus any changes to the
container will impact the cache until it expires and is reloaded.
I have created a simple patch that simply creates a new new aggregate
container form the one that is cached. This ensures that any domain/ui code
that might alter the container will not effect other calls to the data
layer. Example: "return new List(cachedList);"
While the code is simple, this does alter how the API behaves I am curious
if people have come to except it to work this way? Or more appropriately is
this meant to work this way for design consistency?
Thanks,
Chris
Re: IBATIS.NET change proposal
Posted by Christopher DeGuise <ch...@be-pragmatic.com>.
Sure, I have attached a patch file that has the changes and a unit test that
shows my issue. I have included the test in line as well for discussion.
This test would fail in the current code base.
/// <summary>
/// Tests handling of Aggregate results from cache.
/// </summary>
/// <remarks>The aggregate in the cache should immutable</remarks>
[Test]
public void TestAggregateContainer()
{
IList list =
dataMapper.QueryForList("GetCachedAccountsViaResultMap", null);
Assert.IsTrue(list.Count > 0);
int originalCount = list.Count;
list.RemoveAt(0);
IList list2 =
dataMapper.QueryForList("GetCachedAccountsViaResultMap", null);
Assert.IsTrue(list2.Count == originalCount);
}
Thanks,
Chris
On Tue, Jun 17, 2008 at 2:36 PM, Gilles Bayon <ib...@gmail.com> wrote:
> Hi Christopher
>
> Can you give a real example of your problem, what you are expected and the
> patch ?
>
> --
> Cheers,
> Gilles
>
Re: IBATIS.NET change proposal
Posted by Gilles Bayon <ib...@gmail.com>.
Hi Christopher
Can you give a real example of your problem, what you are expected and the
patch ?
--
Cheers,
Gilles