zzzprojects / EntityFramework-Effort

Entity Framework Effort is a powerful tool that enables a convenient way to create automated tests for Entity Framework based applications.
https://entityframework-effort.net/
MIT License
431 stars 99 forks source link

ExecuteSqlCommand can't be used #215

Closed josecamachovaca closed 1 year ago

josecamachovaca commented 1 year ago

Here is what to include in your request to make sure we implement a solution as quickly as possible.

1. Description

Tried to use ExecuteSqlCommand with a simple sql update query using 1 parameter but its not accepted. the parameter is a SqlDbType.Structured

2. Exception

System.ArgumentException: The provided parameter object is incompatible

Exception message:
Stack trace:
EffortParameterCollection.AddRange(Array values)
ObjectContext.CreateStoreCommand(String commandText, Object[] parameters)
ObjectContext.ExecuteStoreCommandInternal(String commandText, Object[] parameters)
<>c__DisplayClass174_0.<ExecuteStoreCommand>b__1()
ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
<>c__DisplayClass174_0.<ExecuteStoreCommand>b__0()
DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
ObjectContext.ExecuteStoreCommand(TransactionalBehavior transactionalBehavior, String commandText, Object[] parameters)
InternalContext.ExecuteSqlCommand(TransactionalBehavior transactionalBehavior, String sql, Object[] parameters)
Database.ExecuteSqlCommand(TransactionalBehavior transactionalBehavior, String sql, Object[] parameters)
Database.ExecuteSqlCommand(String sql, Object[] parameters)

3. Fiddle or Project

If you are able,

Provide a Fiddle that reproduce the issue: https://dotnetfiddle.net/25Vjsn

Or provide a project/solution that we can run to reproduce the issue.

Otherwise, make sure to include as much information as possible to help our team to reproduce the issue.

4. Any further technical details

Add any relevant detail can help us.

JonathanMagnan commented 1 year ago

Hello @josecamachovaca ,

Effort is a NoSQL non-relational provider. So it doesn't accept any SQL but allow to use LINQ.

So this error is expected as you currently try to use it as a SQL database.

It supports stored procedure but not the way you would probably want to use it: https://nmemory.net/stored-procedures

Best Regards,

Jon