问题
To my knowledge, the whole point of Entity framework is to simplify and unify data access models.
I downloaded latest Oracle's .net tools (ODAC 11.2 Release 4) which claims EF4 support, and I'm trying to import some Oracle stored procedure (through function import) that has one ref cursor as output param. When I read the documentation on Oracle's site
It says that I have to define each field returned by the ref cursor in my app.config. Well. That's extremely stupid and makes the whole Entity framework useless for Oracle.
Am I missing something?
回答1:
the whole point of Entity framework is to simplify and unify data access models
In theory yes. In practice MS targets MS tools = they work only on support of SQL server and SQL Server CE features. If other databases provide some special additional features they are either not available in EF or must be somehow hacked in.
stored procedure (through function import) that has one ref cursor as output param.
That is the example of such feature. I don't know about possibility of returning database cursor from stored procedure in SQL server and EF really doesn't support that.
it says that I have to define each field returned by the ref cursor in my app.config. well.. That's extremely stupid and makes the whole Entity framework useless for Oracle.
But that is not problem of EF but of the way how Oracle build the API to use it. IMHO the whole cursor is somehow hidden by ODP.NET and it pass normal result set to EF. The mapping of cursor result is described in configuration.
回答2:
I agree with you 100%. Oracle's EF implementation is highly lacking. The mapping is stupid, error prone and nightmare to maintain. At the very least Oracle should have provided a generator tool that reverse engineers the SP code and create a mapping. Even if perfect mapping is not possible it would be a start. Also it doesn't support functions and our Oracle standard favours functions over SPs wherever possible. Returning multiple refcursors are also not possible.
来源:https://stackoverflow.com/questions/8740420/whats-the-point-of-orm-if-i-have-to-define-every-field-in-app-config-for-oracle