Base solution for your next web application
Open Closed

Include from System.Data.Entity not found #2278


User avatar
0
benjaminrivero created

On this part of the tutorial:

<a class="postlink" href="https://www.aspnetzero.com/Documents/Developing-Step-By-Step-Mvc-Angularjs#changing-getpeople-method">https://www.aspnetzero.com/Documents/De ... ple-method</a>

comes an example using "Include" extension method for bring relation with Phones

var persons = _personRepository
        .GetAll()
        .Include(p => p.Phones)
        .WhereIf(
            !input.Filter.IsNullOrEmpty(),
            p => p.Name.Contains(input.Filter) ||
                    p.Surname.Contains(input.Filter) ||
                    p.EmailAddress.Contains(input.Filter)
        )
        .OrderBy(p => p.Name)
        .ThenBy(p => p.Surname)
        .ToList();

I am making a custom application follow that example with Angular 1, Module Zero and Entity Framework, and on one of my AppService files on the Application Layer. I am trying to do the same thing, using the Include extension method, but the problem is that this method is not recognized, there is no "using" that solve this problem, I can't compile. I read that this belong to System.Data.Entity so add this "using" but is not working.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

1 Answer(s)
  • User Avatar
    0
    benjaminrivero created

    I figure that is (now obviously) required include Entity Framework Package in Application Project. (where the DTO Resides)

    Just open console, set Project default to Application and install Entity Framework

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)