We want to write a new application in C# that uses our existing database (SqlServer). There are many stored procedures and functions in the database. The database has several schemes. Which OR mapper in C# would you recommend for this?

We first thought of Entity Framework, but we didn't like the way it handles stored procedures. The way the parameters have to be passed is bad to write.

public int CountOfOrders(int productId, OutputParameter<int> returnValue = null)
    SqlParameter param1 = new SqlParameter
        ParameterName = "@ProductID",
        Value = productId,
        SqlDbType = System.Data.SqlDbType.Int

    var countOfOrders = new SqlParameter
        ParameterName = "@CountOfOrders",
        Direction = System.Data.ParameterDirection.Output,
        SqlDbType = System.Data.SqlDbType.Int,

    var res = Database.SqlQuery<CountOfOrderResult>("CountOfOrders @ProductID, @CountOfOrders OUT", param1, countOfOrders).FirstOrDefault();
    return (int)countOfOrders.Value;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.