Bogdan Verbenets
Bogdan Verbenets

Reputation: 26956

How to run T-SQL queries using LINQ to Entities?

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

Answers (1)

Related Questions