I'm hoping someone can point me in the right direction. I would like to use a package function within my query using LINQ like so:
var query = from c in context.SomeEntity
select new
{
FieldA = c.FieldA,
FieldB = c.FieldB,
FieldC = context.SomePackageFunction(c.ID)
};
I have created the SomePackageFunction in my context and it works fine on its own, but not when combined within a LINQ query.
I am hoping this would result in a PL/SQL query similar to:
SELECT
1 AS [C1],
[Extent1].[FieldA] AS [FieldA],
[Extent1].[FieldB] AS [FieldB],
[MySchema].[MyPackage].[MyFunction]([Extent1].[ID]) AS [C2]
FROM [MySchema].[MyTable] AS [Extent1]
How can I accomplish this in a code-first approach?
Using a package function or stored procedure within LINQ
I should also mention that when I attempt to execute the LINQ query above, I get a TargetParameterCountException : Parameter count mismatch.
Even if I try to hard-code the parameter values of the function, I get this exception.
I am in need of a way to combine querying both entities and functions in order to hydrate new objects using LINQ. We are using legacy Oracle ERP where many of the data items are obtained from calling packages.
Even if I try to hard-code the parameter values of the function, I get this exception.
I am in need of a way to combine querying both entities and functions in order to hydrate new objects using LINQ. We are using legacy Oracle ERP where many of the data items are obtained from calling packages.
You can trace the SQL query that is sent to the server and parameters collection via dbMonitor.
Download link: http://www.devart.com/dbmonitor/dbmon3.exe
Documentation: http://www.devart.com/dotconnect/oracle ... nitor.html
If this doesn't help, please send us a small test project with the corresponding DDL/DML script to reproduce the issue in our environment.
Download link: http://www.devart.com/dbmonitor/dbmon3.exe
Documentation: http://www.devart.com/dotconnect/oracle ... nitor.html
If this doesn't help, please send us a small test project with the corresponding DDL/DML script to reproduce the issue in our environment.