Comments (8)
Investigating this issue I could notice that version 1.6.3, even having a Async method always used the SYNC implementor.
I'm still looking to fix it but I really need information to find the issue.
from dapper-extensions.
Any Updates for this?
I have the same issue,
After run this code:
await DbConnection.UpdateAsync(aggregateRoot, DbTransaction);
I got this is the exception:
'DbConnection.Update(aggregateRoot, DbTransaction)' threw an exception of type 'System.Data.SqlClient.SqlException' Class: 15 ClientConnectionId: {2e64d6d8-18eb-4c31-be0f-8d788125156b} Data: {System.Collections.ListDictionaryInternal} ErrorCode: -2146232060 Errors: {System.Data.SqlClient.SqlErrorCollection} HResult: -2146232060 HelpLink: null InnerException: null LineNumber: 1 Message: "Must declare the scalar variable \"@u_13\"." Number: 137 Procedure: "" Server: "REMOVED_FOR_SECURITY" Source: "Core .Net SqlClient Data Provider" StackTrace: "...."
Same as MitarNikolic, when I look at the SQL in the server profiler of "Microsoft SQL-Server management studio" you can see that wrong SQL gets generated.
FYI:
This only happens after migrate to:
"DapperExtensions" Version="1.7.0"
The exception is fixed for the prev version:
"DapperExtensions" Version="1.6.3"
But unfourtunally you get the warning:
Severity Code Description Project File Line Suppression State
Warning NU1701 Package 'DapperExtensions 1.6.3' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
from dapper-extensions.
Hi @urodriguez , just to help me, did you try to use the Sync update?? I'm asking because the SQL Generation is the same for both of them and if one works and the other don't I'll have a more restricted area to look for.
Also it would help to send me the code example with the mappings
from dapper-extensions.
I didn't.
because using the sync update version is not performant for me.
thats why tried to use the async version on 1.7 but it didnt work.
however it worked for 1.6.3
from dapper-extensions.
@urodriguez I asked about the test not for performance but for helping me to find the issue. If the same happens in the sync version it's 1 thing... if only in asysnc its something else
from dapper-extensions.
This is the same as #306, and I have it as well. Below is a short program that causes the bug - at least on my machine in LinqPad, which throws with the message "Must declare the scalar variable "@u_3."
void Main()
{
// Remember to run the sql at the bottom to create the tables
var connectionString = "***INSERT CONNECTIONSTRING HERE***";
var iterationCount = 50;
Init();
var task1 = Task.Run(() =>
{
var conn = new SqlConnection(connectionString);
conn.Open();
for (int i = 0; i < iterationCount; i++)
{
conn.Update(new TestA { Id = 1, Prop1 = 1, Prop2 = 2, Prop3 = 3 });
}
});
var task2 = Task.Run(() =>
{
var conn = new SqlConnection(connectionString);
conn.Open();
for (int i = 0; i < iterationCount; i++)
{
conn.Update(new TestB { Id = 1, Prop1 = "1", Prop2 = "2" });
}
});
Task.WaitAll(task1, task2);
void Init()
{
var conn = new SqlConnection(connectionString);
conn.Open();
conn.Insert(new TestA { Prop1 = 1, Prop2 = 2, Prop3 = 3 });
conn.Insert(new TestB { Prop1 = "1", Prop2 = "2" });
}
}
public class TestA
{
public long Id { get; set; }
public long Prop1 { get; set; }
public long Prop2 { get; set; }
public long Prop3 { get; set; }
}
public class TestB
{
public long Id { get; set; }
public string? Prop1 { get; set; }
public string? Prop2 { get; set; }
}
public class TestAMapper : ClassMapper<TestA>
{
public TestAMapper()
{
Table("TestA");
AutoMap();
}
}
public class TestBMapper : ClassMapper<TestB>
{
public TestBMapper()
{
Table("TestB");
AutoMap();
}
}
/*
create table dbo.TestA
(
Id int identity,
Prop1 int,
Prop2 int,
Prop3 int
)
go
create table dbo.TestB
(
Id int identity,
Prop1 nvarchar(50),
Prop2 nvarchar(50)
)
go
*/
from dapper-extensions.
Any update on this issue ?
from dapper-extensions.
Pretty sure this project is more or less abandoned :/
from dapper-extensions.
Related Issues (20)
- Mapper Documentation? HOT 2
- Get methods is not map model Guid?(nullable guid) property HOT 2
- Invalid table name(Oracle) HOT 4
- The Predicates system did not restore the table alias HOT 1
- Insert error about multithreading HOT 3
- Insert the entity with not null ID. HOT 3
- UpdateAsync throws error: Must declare the scalar variable "@u_0" HOT 1
- Unable to mapped underscore column in dapper extension HOT 2
- Custom mappers HOT 2
- Insert Error HOT 1
- Get by key value is broken, must use Get by object
- contains does not work HOT 1
- Async methods are throwing exceptions because Task.FromResult does not specify type <T>
- Add predicate to Update
- Unable to set my mapper class as the mapper that is used to insert an object into a table HOT 1
- Criticar Bug, DeleteAsync doesn't work with predicates HOT 2
- INSERT INTO ... RETURN Id INTO @IdOutParam don't work with PostgreSQL
- Problems with class mapper
- The prompt caused by concurrency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dapper-extensions.