Use EF to retrieve the data returned by the database and ef to retrieve the data returned by the database.

Source: Internet
Author: User

Use EF to retrieve the data returned by the database and ef to retrieve the data returned by the database.
Directory

1. Take the custom type returned by the oracle UDF.

 

1. Take the custom type returned by the oracle UDF. 1. First create a function to return a set of custom types
-- 1. create or replace type UT_BLOCKED_STATISTICS as object (character VARCHAR2 (11), -- character VARCHAR2 (111), character VARCHAR2 (11), THREE_DPT_NME VARCHAR2 (111), CASE_NUM NUMBER, BLOCKED_NUM NUMBER)
-- 2. create or replace type "UT_BLOCKED_STATISTICS_LIST" as table of UT_BLOCKED_STATISTICS;
-- 3. create a UDF and return a set of custom types. Here, the feature bulk collect [batch insert] create or replace function get_BLOCKED_STATISTICS (begintime in date, endtime in date) is used) RETURN response as UT statistics; -- custom type set BEGIN select UT_BLOCKED_STATISTICS (statistics, -- here you need to manually display the values, Three_dpt_cde, Three_dpt_nme, CASE_NUM, BLOCKED_NUM) of the corresponding custom type set) bulk collect into UT from (select two_dpt_cde, two_dpt_nme, Three_dpt_cde, Three_dpt_nme,CASE_NUM,BLOCKED_NUMFrom Mytable where...); return UT; end;

 

-- 4. here, you can use table () to query the result set returned by the user-defined function. It is as convenient as querying table data as selecting t. * from table (get_BLOCKED_STATISTICS (to_date ('... ', 'yyyy-MM-dd HH24: mi: ss'), to_date (...))) t where ....

 

2. EF program call

First, create a class field corresponding to the database's custom type UT_BLOCKED_STATISTICS model class BlockedStatistics

Context. Database. SqlQuery <BlockedStatistics> (strSql). ToList () // SQL query string concatenated by strSql // The class created by BlockedStatistics corresponding to the custom type
// EntityFramework. dll v4.0 is used

 

If the returned custom type is saved, how can I retrieve the returned value in EF ....

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.