schotime / NPoco

Simple microORM that maps the results of a query onto a POCO object. Project based on Schotime's branch of PetaPoco
Apache License 2.0
848 stars 302 forks source link

Any value of @ in the SQL causes exception #639

Closed tbasallo closed 3 years ago

tbasallo commented 3 years ago

I have some scripts that create users and such. IN this case, a login could be an email address. If I try to execute the following: await db.ExecuteAsync($"USE {databaseName}; CREATE USER [{loginModel.Name}] FOR LOGIN [{loginModel.Name}];");

Where the login has an @ in it, i get the error: Parameter '@domain' specified but none of the passed arguments have a property with this name (in 'USE DB; CREATE USER [user@domain.com] FOR LOGIN [user@domain.com];')

Is there a way to tell NPoco to ignore parameters? or the @ site?

schotime commented 3 years ago

You have to escape them with double @.

tbasallo commented 3 years ago

That did it. Thanks.