BrooklynSon
BrooklynSon

Reputation: 2103

How to assign ObjectResult<> from EF

After using DB first approach with EF my context.cs file has the follwing for a stored procedure:

public virtual ObjectResult<selectCases_Result> selectCases()
{
    return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<selectCases_Result>("selectPurgeCaseFolio");
}

In a sepearte class file I'm trying to invoke it to get the result with the following:

public SelectCases()
{    
  var result = _context.selectCases;
}

However the error I get is on result:

"Cannot assign method group to an implicitly-typed local variable"

How can I get the result of this select query into a dataset or anyother type of object to see the results?

Upvotes: 0

Views: 434

Answers (1)

Nkosi
Nkosi

Reputation: 247461

You forgot to call the method (with ())

var result = _context.selectCases(); 

You are trying to call it like a property when you should be calling it as a method

Upvotes: 1

Related Questions