Potrzebuje stworzyć relację jeden do wielu,
przykładowo jedna książka ma dwóch autorów.
Nie wiem jak za bardzo się za to zabrać, oto moje wypociny które nie działają:
db.Set(new Author("J.R.R. Tolkien"));
db.Set(new Author("J.K. Rowling"));
db.Set(new Author("Mark A.Lassoff"));
db.Set(new Author("Tom Stachowitz"));
IObjectSet result = db.Get(new Author());
ListResult(result);
Author author = new Author();
List<Author> authors = new List<Author>();
author.Name = "J.R.R. Tolkien";
IObjectSet resultAuthor = db.Get(author);
authors.Add(resultAuthor);
db.Set(new Book("Władca Pierścieni: Drużyna Pierścienia", authors, new DateTime(2012)));
Tutaj akurat książka ma jednego autora ale i tak opiera się na liście. Później dla testów chcę dodać książkę o 2 autorach.
Zrobiłem coś takiego:
db.Set(new Author("J.R.R. Tolkien"));
db.Set(new Author("J.K. Rowling"));
db.Set(new Author("Mark A.Lassoff"));
db.Set(new Author("Tom Stachowitz"));
IObjectSet result = db.Get(new Author());
ListResult(result);
Author author = new Author();
List<Author> authors = new List<Author>();
author.Name = "J.R.R. Tolkien";
IObjectSet resultAuthor = db.Get(author);
Author author2 = (Author)resultAuthor.Next();
authors.Add(author2);
db.Set(new Book("Władca Pierścieni: Drużyna Pierścienia", authors, new DateTime(2012)));
result = db.Get(new Book());
ListResult(result);
Odpala się, wyświetla mi książkę ale nie wyświetla poprawnie autora tylko System.Collections.GenericList'1 [OBDProject.Author]
Nie wiem czy ten sposób jest poprawny, prosiłbym też o info.