Ragnarsson
Ragnarsson

Reputation: 1825

Metadata file '.dll' could not be found with LINQ

I have this method, firstly, it gets all data from database (joined tables), then it filters the result with search property and search keyword, as follow. Everything is fine until I add switch ... case with LINQ, and I get the error "Metadata .dll could not be found". Obviously, the error comes from it, but I have no clue what error is, I am so new to LINQ.

public IPagedList<dynamic> Execute(int pageIndex, int pageSize, string searchProperty, string searchKeyword)
{
     IQueryable<dynamic> dokumente;
     dokumente = session.Query<Dokument>().Select(dokument =>  
                 new {Beschreibung = dokument.Beschreibung,                            
                      Link =  dokument.Link,
                      Dokumenttyp = dokument.Dokumenttyp.Bezeichnung,                            
                     }).ToList().AsQueryable();

     if (!string.IsNullOrEmpty(searchProperty))
     {
         switch (searchProperty)
         {
             case "Beschreibung":
                 dokumente = dokumente.Where(x => x.Beschreibung == searchKeyword);
                 break;
             case "Link":
                 dokumente = dokumente.Where(x => x.Link == searchKeyword);
                 break;
             case "Dokumenttyp":
                 dokumente = dokumente.Where(x => x.Dokumenttyp == searchKeyword);
                 break;                
         }
     }          
     return new PagedList<dynamic>(dokumente, pageIndex, pageSize);
}

Upvotes: 0

Views: 3620

Answers (1)

Jasper van den Bosch
Jasper van den Bosch

Reputation: 3218

This is not a bug in your code, it has to do with your packaging and configuration. Try restarting Visual Studio, or if all else fails, put your solution together anew.

See also: Metadata file '...\Release\project.dll' could not be found in Visual Studio

Upvotes: 2

Related Questions