-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix DyRepository SqlParameterCollection paramType problem
- Loading branch information
Showing
6 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/SmartSql.Test.Unit/DyRepository/UserRepository_Test.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using SmartSql.Data; | ||
using SmartSql.Test.Repositories; | ||
using Xunit; | ||
|
||
namespace SmartSql.Test.Unit.DyRepository | ||
{ | ||
public class UserRepository_Test : DyRepositoryTest | ||
{ | ||
private IUserRepository _userRepository; | ||
public UserRepository_Test() | ||
{ | ||
var smartSqlBuilder = new SmartSqlBuilder().UseXmlConfig().Build(); | ||
_userRepository = RepositoryFactory.CreateInstance(typeof(IUserRepository), smartSqlBuilder.SqlMapper) as IUserRepository; | ||
} | ||
|
||
|
||
[Fact] | ||
public void SP_QueryUser() | ||
{ | ||
SqlParameterCollection dbParameterCollection = new SqlParameterCollection(); | ||
dbParameterCollection.Add(new SqlParameter("Total", null, typeof(int)) | ||
{ | ||
DbType = System.Data.DbType.Int32, | ||
Direction = System.Data.ParameterDirection.Output | ||
}); | ||
var list = _userRepository.SP_QueryUser(dbParameterCollection); | ||
Assert.NotNull(list); | ||
dbParameterCollection.TryGetParameterValue("Total", out int total); | ||
Assert.NotEqual(0, total); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
using SmartSql.Test.Entities; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Text; | ||
using SmartSql.Configuration; | ||
using SmartSql.Data; | ||
using SmartSql.DyRepository.Annotations; | ||
|
||
namespace SmartSql.Test.Repositories | ||
{ | ||
public interface IUserRepository | ||
{ | ||
long Insert(User user); | ||
IEnumerable<User> Query(); | ||
[Statement(CommandType = CommandType.StoredProcedure,Sql = "SP_QueryUser")] | ||
IEnumerable<User> SP_QueryUser(SqlParameterCollection sqlParameterCollection); | ||
} | ||
} |