I am getting the following exception during the foreach loop of refresh model as it tries to enumerate through the results retreived by the query. I have not been able to find anything relating to this error anywhere else on the internet. Can someone point out what I am doing wrong?
System.MissingMethodException was unhandled
Message=Method not found: 'Void Raven.Abstractions.Data.IndexQuery.set_DefaultField(System.String)'. Source=Raven.Client.Lightweight
StackTrace:
at Raven.Client.Document.AbstractDocumentQuery`2.GenerateIndexQuery(String query)
at Raven.Client.Document.AbstractDocumentQuery
2.InitializeQueryOperation(Action
2 setOperationHeaders) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\AbstractDocumentQuery.cs:line 399at Raven.Client.Document.AbstractDocumentQuery`2.InitSync() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\AbstractDocumentQuery.cs:line 434
at Raven.Client.Document.AbstractDocumentQuery`2.get_QueryResult() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\AbstractDocumentQuery.cs:line 421
at Raven.Client.Linq.RavenQueryProviderProcessor`1.ExecuteQueryTProjection in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Linq\RavenQueryProviderProcessor.cs:line 1263
at Raven.Client.Linq.RavenQueryProviderProcessor`1.Execute(Expression expression) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Linq\RavenQueryProviderProcessor.cs:line 1244
at Raven.Client.Linq.RavenQueryProvider`1.Execute(Expression expression) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Linq\RavenQueryProvider.cs:line 138
at Raven.Client.Linq.RavenQueryProvider`1.System.Linq.IQueryProvider.Execute(Expression expression) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Linq\RavenQueryProvider.cs:line 195
at Raven.Client.Linq.RavenQueryInspector`1.GetEnumerator() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Linq\RavenQueryInspector.cs:line 97
at AdminPanel.RefreshModel() in C:\AdminPanel\AdminPanel.xaml.cs:line 111
private void RefreshModel()
{
MainModel.Movies.Clear();
foreach (FriendlyName movie in App.Database.QueryAllMovies())
{
MainModel.Movies.Add(movie);
}
}
public IEnumerable<FriendlyName> QueryAllMovies()
{
using (var session = DocumentStore.OpenSession())
{
return session.Query<Movie, Movies_AsFriendlyName>().As<FriendlyName>();
}
}
class Movies_AsFriendlyName : AbstractIndexCreationTask<Movie>
{
public Movies_AsFriendlyName()
{
Map = movies => movies.Select(movie => new { Id = movie.Id, Name = movie.FileName });
TransformResults = (database, movies) => movies.Select(movie => new { Id = movie.Id, Name = movie.FileName });
}
}
public class FriendlyName
{
public string Name { get; set; }
public string Id { get; set; }
public FriendlyName(string id, string name)
{
Id = id;
Name = name;
}
public override string ToString()
{
return Name;
}
}