Reputation: 26956
I want to execute some T-SQL. I want to use existing L2E connection configurations, I don't want to add a new SqlClient provider connection configuration to my .config file. How do I do that? ObjectContext seems to have only methods that return results with classes from data mapping schema.
I've tried doing ObjectContext.Connection.CreateCommand method, then specifying my T-SQL as the command text, but it failed with a message that is something like "could not understand what entities you are talking about in your query".
Upvotes: 4
Views: 860
Reputation: 160922
You can use ExecuteStoreQuery()
. Also see How to: Directly Execute Commands Against the Data Source
Upvotes: 5