How to call a Stored procedure in entity framework in silverlight 3.
I want to call a stored procedure that is not particularly related to any one entity. I can't use function mapping since i don't have the all three insert, update, delete stored procedures
I found this code on another post but I can't add the reference of System.Data.Entity to my project becasue I get an error "System.Data.Entity dll was not build against silverlight runtime"
public void MyMethod(
int productID)
{
using (EntityConnection connection = new EntityConnection(Connection.ConnectionString))
{
connection.Open();
EntityCommand command = connection.CreateCommand();
command.CommandText = "NorthwindEFEntities.MySPName";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("ProductID", productID);
try
{
command.ExecuteNonQuery();
}
finally
{
connection.Close();
}
}
}