Oracle.ManagedDataAccess.EntityFramework 6.122.1.0 library is used to access to an Oracle Database from MVC ASP.Net application. It is the latest library version from the NuGet as of November, 14th 2017
protected override Expression<Func<MyEntity, object>> getSelector()
{
return m => new
{
ID = m.ID,
NAME = m.Name,
LONGSTRING = "Blah-blah-blah-blah...some thousands characters..." +
m.ID + "blah-blah...blah"
};
}
protected override ProblemMethod()
{
var result = db.MyEntity.Select(getSelector()).ToList();
}
There is the problem. That happens, because very long string (some thousands characters) is concatinated into LONGSTRING
, and execution of Select
throw the next exception.
ORA-00932: inconsistent datatypes: "'expected CLOB got CHAR"
My class need to get Expression
with the GetSelector()
overriding.
How to overcome the error or get round it? One way to get round is force EF to execute Select
on the client. How to do it?
PS: Same question in Russian.
I should have to present MyEntity
CREATE TABLE MyEntity (ID NUMBER(10), Name VARCHAR2(100));
If you want to execute the select on the client (i.e. loading ALL MyEntity's and filtering them on the client), you can do:
var result = db.MyEntity.ToList().AsQueryable().Select(getSelector()).ToList();
The first ToList() loads all entities from the DB. The AsQueryable() allows you to use the Expression function.
I hope this helps.
Cheers, Nicola
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With