Skip to content

Commit

Permalink
checked a potential bug in the async functions, turns out it's a bug …
Browse files Browse the repository at this point in the history
…in the Dapper library
  • Loading branch information
MoonStorm committed Oct 27, 2016
1 parent 330f56b commit abfd6bf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 29 deletions.
24 changes: 12 additions & 12 deletions Dapper.FastCrud.Tests/Relationships.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ Scenario Outline: Query single relationship parent with children (external datab
@InMemoryDatabase
Scenario Outline: Query single relationship parents with children (in-memory database)
Given I have initialized a <database type> database
When I insert <entity count> workstation entities using <method type> methods
And I insert <entity count> employee entities parented to existing workstation entities using <method type> methods
When I insert <parent entity count> workstation entities using <method type> methods
And I insert <child entity count> employee entities parented to existing workstation entities using <method type> methods
And I query for all the workstation entities combined with the employee entities using <method type> methods
Then the queried workstation entities should be the same as the local ones
Examples:
| database type | entity count | method type |
| LocalDb | 10 | synchronous |
| LocalDb | 10 | asynchronous |
| database type | parent entity count | child entity count | method type |
| LocalDb | 10 | 20 | synchronous |
| LocalDb | 10 | 20 | asynchronous |

@ExternalDatabase
Scenario Outline: Query single relationship parents with children (external database)
Given I have initialized a <database type> database
When I insert <entity count> workstation entities using <method type> methods
And I insert <entity count> employee entities parented to existing workstation entities using <method type> methods
When I insert <parent entity count> workstation entities using <method type> methods
And I insert <child entity count> employee entities parented to existing workstation entities using <method type> methods
And I query for all the workstation entities combined with the employee entities using <method type> methods
Then the queried workstation entities should be the same as the local ones
Examples:
| database type | entity count | method type |
| PostgreSql | 10 | synchronous |
| PostgreSql | 10 | asynchronous |
| MySql | 10 | synchronous |
| MySql | 10 | asynchronous |
| database type | parent entity count | child entity count | method type |
| PostgreSql | 10 | 20 | synchronous |
| PostgreSql | 10 | 20 | asynchronous |
| MySql | 10 | 20 | synchronous |
| MySql | 10 | 20 | asynchronous |

@InMemoryDatabase
Scenario Outline: Count single relationship parents with children (in-memory database)
Expand Down
24 changes: 12 additions & 12 deletions Dapper.FastCrud.Tests/Relationships.feature.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Dapper.FastCrud/SqlStatements/RelationshipSqlStatements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public async Task<TEntity> SelectByIdAsync(IDbConnection connection, TEntity key
false,
statementOptions.Transaction,
(int?)statementOptions.CommandTimeout?.TotalSeconds, relationshipInstanceBuilder);

// a problem in the Dapper library would cause this function to fail
// see https://github.com/StackExchange/dapper-dot-net/issues/596 for more info
return this.FilterDuplicates(queriedEntityIdentities).SingleOrDefault();
}

Expand Down Expand Up @@ -223,6 +226,9 @@ public async Task<IEnumerable<TEntity>> BatchSelectAsync(IDbConnection connectio
statementOptions.Transaction,
(int?)statementOptions.CommandTimeout?.TotalSeconds,
relationshipInstanceBuilder);

// a problem in the Dapper library would cause this function to fail
// see https://github.com/StackExchange/dapper-dot-net/issues/596 for more info
return this.FilterDuplicates(queriedEntityIdentities);
}

Expand Down
5 changes: 0 additions & 5 deletions Dapper.FastCrud/packages.config

This file was deleted.

0 comments on commit abfd6bf

Please sign in to comment.