0

I tried DapperExtensions, Dapper.Extensions.Linq and linq2dapper to no avail. I will try Dapper.SimpleCRUD-with-Oracle. I will probably settle with a Stored Procedure instead. I want to use TableDirect with no embedded SQL statement. How can I use Dapper and Linq with a TableDirect? Or, how can I use TableDirect without embedded SQL, and filter a table?

Following are my problems:

  • I could not create Predicate without run time error.
  • I need missing configuration
  • I got ORA error about table saying "column not correct, runtime error".

How to use Dapper LINQ with TableDirect (without embedded SQL) with ORACLE?

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
kblau
  • 2,094
  • 1
  • 8
  • 20

2 Answers2

1

You can achieve this with simple Dapper. For example, look at the following code from Dapper:

public static IEnumerable<T> Query<T>(this IDbConnection cnn, string sql, object param = null, IDbTransaction transaction = null, bool buffered = true, int? commandTimeout = default(int?), CommandType? commandType = default(CommandType?));

Look at the last commandType parameter. It supports the TableDirect value that you are looking for.

As far as other extensions of Dapper you mentioned in question, I do not think they will support it. I know for sure Dapper Extensions do not support it; not sure about others.

This is because, those extensions are basic query generators written over Dapper. So, you are using them for generating the query and in that case, that parameter value will/should be Text. If you want to use other values, bypass the extension and use simple Dapper.

If you want to simply provide a table name or stored procedure name, why use query generator? Just use Dapper.

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
0

I used //https://github.com/jmo21/Dapper.SimpleCRUD-with-Oracle-/blob/master/Dapper.SimpleCRUD/SimpleCRUD.cs . No nuget package for this ORACLE dialect. It just obfuscates the WHERE clause, and it is an answer, when I the organization probably will not like SELECT.. FROM ... WHERE...

We don't have SQL injection possible in any case.

kblau
  • 2,094
  • 1
  • 8
  • 20