Entity Framework query syntax for SQL Server 2017 database

Suppose I am working with a graph database from this example (SQL Server 2017):

https://docs.microsoft.com/en-us/sql/relational-databases/graphs/sql-graph-sample

I have the following SQL query:

-- Find Restaurants that John likes
SELECT Restaurant.name
FROM Person, likes, Restaurant
WHERE MATCH (Person-(likes)->Restaurant)
AND Person.name = 'John';

I created a model in C # using EF 6.1.3, and it automatically generates all classes and everything from the database (EF Designer from the database). This all works great. I can even interview all people using a simple method such as:

public ICollection<People> ListPeople() => Entities.Peoples.ToList();

, , , ... Entity Framework? LINQ ? (-, , , , , )

-

 public ICollection<Restaurant> ListRestaurantsLikedByPerson(string personName)
        {
            var result = from restaurant in Entities.Restaurants, person in Entities.Peoples, likes in Entities.likess
                where match (person - likes -> restaurant)
                and person.name = personName;

            return result;
        }

... ?

+5
3

Entity Framework SQL.

+3

You can use the Microsoft Cosmos DB API to access the functions of the Graphics tables in SQL Server 2017. Here is the link

-1
source

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


All Articles