I'm using UWP, Sqlite and Linq to make ObservableCollections to bind to my XAML Listviews. No problems thus far. Next I like to have the results of a join query into a List, also to bind to a Listview. This results in an error even with the simplified code below:
public class BooksAndSeries
{
public int PublYear { get; set; }
public string SeriesName { get; set; }
public string Title { get; set; }
}
public static List<BooksAndSeries> SelBooksSeries { get; set; }
public static void LoadSearchedBooks()
{
using (CatDataContext catDB = new myBooks.Model.CatDataContext())
{
var SearchedBooks = from Book bb in catDB.Books
select new BooksAndSeries { PublYear = bb.PublYear, Title = bb.Title };
SelBooksSeries = new List<BooksAndSeries>(SearchedBooks);
}
}
The query gives the error: System.InvalidOperationException HResult=0x80131509 Message=No coercion operator is defined between types 'myBooks.GenModule+BooksAndSeries' and 'myBooks.Model.Book'. Source= StackTrace:
I'm using the latest Microsoft VS Community edition and Microsoft.EntityFrameworkCore.Sqlite 1.1.5.
User contributions licensed under CC BY-SA 3.0