¿如何通过EF调用oracle中的现有存储过程?

时间:2019-01-04 23:41:06

标签: c# asp.net-mvc oracle entity-framework-6

我有一个需要从我的项目中调用的存储过程,由于从未使用过Oracle和Entity Framework,因此遇到了这个问题,您能帮我如何调用存储过程吗?。

这是我的存储过程:

//Program where user enters two positive numbers
//and program will display various things.

#include <iostream>
using namespace std;

int main()
{
//Displays information of what program will do
cout<< "Practice with iterations\n\n"
    << "The function of this program is, given 2 positive numbers, the"
    << " program";
cout<< "\nwill display the following\n\n";

cout<< "\t1. All even numbers between firstNum and secondNum.\n"
    << "\t2. All odd numbers between firstNum and secondNum.\n"
    << "\t3. Sum of all even numbers between firstNum and secondNum.\n"
    << "\t4. Sum of all odd numbers between firstNum and secondNum.\n"
    << "\t5. All prime numbers between firstNum and secondNum.\n"
    << "\t6. Factorial of the secondNum.\n"
    << "\t7. The numbers and their squares between firstNum and "
    << "secondNum."<< endl;

//Declare first and second number variables
int firstNum;
int secondNum;
bool flag= true;    //Set to true
char x;             //Use to see if value entered is letter

//Ask user to input values
cout<< "\n\nEnter the first number:\t\t";
cin>> firstNum;

if (cin.fail())
{
    cin.clear();
    cin.ignore(256,'\n');
    flag= 0;
}

cout<< "Enter the second number:\t";
cin>> secondNum;

if (cin.fail())
{
    cin.clear();
    cin.ignore(256,'\n');
    flag= 0;
}

//If user puts wrong input
if (firstNum>secondNum)
    cout<< "\nError: First number must be < second number.\n";
else if (firstNum<0 || secondNum<0)
    cout<< "\nError: Invalid number: Number must be positive.\n";
else if (firstNum==x || secondNum==x)
    cout<< "\nError: Invalid number: Numbers must be positive integer.\n";
else
{
    cout<< "\nYou entered: "<< firstNum<< " and "<< secondNum;
}

return 0;
}

1 个答案:

答案 0 :(得分:0)

这里是读取Sys_RefCursor的示例函数

eureka:
  client:
    service-url:
      defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/
    enabled: true
    healthcheck:
      enabled: false
    fetch-registry: true
    register-with-eureka: true
    instance-info-replication-interval-seconds: 10
    registry-fetch-interval-seconds: 10
  instance:
    appname: stubrunner
    instance-id: stubrunner:${spring.application.instance-id:${random.value}}
    lease-renewal-interval-in-seconds: 5
    lease-expiration-duration-in-seconds: 10
    status-page-url-path: management/info
    health-check-url-path: management/health
ribbon:
  eureka:
    enabled: true
server:
  port: 8888
stubrunner:
  cloud:
    eureka:
      enabled: true
    stubbed:
      discovery:
        enabled: false
  idsToServiceIds:
    masterdata-stubs: masterdata