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 do not want to add a new SqlClient provider connection configuration to my .config file. How can I do it? ObjectContext only seems to have methods that return results with classes from the data mapping schema.

I tried to make the ObjectContext.Connection.CreateCommand method and then specify my T-SQL as the text of the command, but it did not go through with a message that was something like "could not understand what entities you are saying in your query."

+4
source share

Source: https://habr.com/ru/post/1388585/


All Articles