Friday, June 14, 2013

Calling User Defined Function in Entity Framework 5

public string ExecuteUserDefinedFunctionReturningScalarStringValue(int inputValue)
{
    var query = "SELECT [dbo].[UserDefinedFunctionName]({0})";
    object[] param = { inputValue };
    var outputString = Context.Database.SqlQuery<string>(query, param).FirstOrDefault();

    return outputString;
}

No comments: