using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.EntityFrameworkCore;
using QueryingDemo.Model;

namespace QueryingDemo.Samples
{
    public class Sample6 : ISample
    {
        public int Number => 6;
        public string Title => "FromSql";
        public void Run(NorthwindContext dc)
        {
            var filter = "%a%";

            var result = dc.Customers
                .FromSql($"SELECT * FROM Customers WHERE CustomerID LIKE {filter}")
                .Where(c => c.CompanyName.Contains("a"))
                .ToList();
        }
    }
}
