Skip to content

Problem with cache when mapping to primitive typed collection #33

Open

Description

@rstraszewski

When using mapping to primitive typed collection convention
SELECT Id, BankAccountNumber AS BankAccountNumbers_$ FROM Account

And then mappping results from database more than one time:
var queryResult = dbConnection.Query<dynamic>(Query, new { Id= id });
var result1 = Slapper.AutoMapper.MapDynamic<ContractorDto>(queryResult).First();
var result2 = Slapper.AutoMapper.MapDynamic<ContractorDto>(queryResult).First();
var result3 = Slapper.AutoMapper.MapDynamic<ContractorDto>(queryResult).First();

Every result has bigger number of bank accounts, result1 two, result2 four and result3 six.
Only after clearing cache the results are good.
So i guess there is some problem with caching and primitive typed collections.

Activity

  1. changed the title [-]Problem with chace when mapping to primitive typed collection[/-] [+]Problem with cache when mapping to primitive typed collection[/+] on May 23, 2016
  2. geirsagberg commented on May 26, 2016

    @geirsagberg
    Contributor

    You can do MapDynamic<T>(queryResult, keepCache: false) to clear cache between calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions