Giter Site home page Giter Site logo

Comments (8)

valfrid-ly avatar valfrid-ly commented on August 15, 2024 1

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.

urodriguez avatar urodriguez commented on August 15, 2024

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.

valfrid-ly avatar valfrid-ly commented on August 15, 2024

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.

urodriguez avatar urodriguez commented on August 15, 2024

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.

valfrid-ly avatar valfrid-ly commented on August 15, 2024

@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.

skovsende avatar skovsende commented on August 15, 2024

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.

anuviswan avatar anuviswan commented on August 15, 2024

Any update on this issue ?

from dapper-extensions.

skovsende avatar skovsende commented on August 15, 2024

Pretty sure this project is more or less abandoned :/

from dapper-extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.