support for functions in oracle database packages

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Micha_
Posts: 10
Joined: Mon 18 Jan 2010 18:58

support for functions in oracle database packages

Post by Micha_ » Wed 10 Feb 2010 12:29

Are there plans to add support for functions in oracle database packages (to add them to the entity model, not only to the storage model)?
And will there be support for user defined types and nested tables?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 11 Feb 2010 13:34

If you are using drag&drop from the Database Explorer, the methods are generated.
If you are using Reverse Engineering Wizard, the methods are not generated.
The reason for this behaviour is the fact that procedures in Oracle are more often used for CUD operations than for querying.

Micha_
Posts: 10
Joined: Mon 18 Jan 2010 18:58

Post by Micha_ » Thu 11 Feb 2010 15:24

Thanks for reply!
But maybe my questions where a little bit misunderstanding. So let me concrete on that:
In the Entity Developer I can see my orcale database packages in the database explorer. If I try to add a storage function out of a package to the storage model there is no poblem. But if I try to add the function to the Entity Model I get the following error: "cannot create method for storage function xyz that can be composed. Only stored procedures may be mapped."

My next problem was on the usage of unsoported data types. If I want to add a stored procedure (or function) containing a parameter that has a user defined type to the storage model I get the message: "The parameter xyz has an unsupported data type 'TABLE'. Cannot create method..."

So my question was, will there be support for storage functions and user defined types in future versions (perhaps this maybe a general problem with the first version of the entity framework and will solved with EF4?).

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 12 Feb 2010 12:08

You can use the following workaround for the function returning scalar type (it is not supported in EDM Designer, but in Entity Developer you can map it):
- add the function to the designer surface (there will be an error message indicating that it is a composable function).
- set the Composable property of the generated stored procedure(in DataSourceModel.Store) to false.
- set the return type to (None).
- go to the CommandText property and set the command text to "begin; :result := .(); end;".
- go to the Parameters tab and adjust the parameters. Set the direction of the result parameter to output.
- drag the procedure to the designer surface. You will get a warning about metadata obtaining. Say 'No', it is not necessary.
Now you can use your function from your code. The return value can be obtained as a ref 'result' parameter of the generated method.
As for the User Defined Types, I am not aware of plans to add them in EF v4 and they are not supported in EF v1.

Post Reply