/// <summary> /// Default constructor assigning new <see cref="Guid"/> becuase entity live also un-persisted. /// </summary> public Book(Library library, string isbn) { AssertUtils.IsTrue(!string.IsNullOrEmpty(isbn)); AssertUtils.IsTrue(library != null, "Library is mandatory for book construction."); Id = Guid.NewGuid(); Isbn = isbn; Library = library; library.AddBook(this); }
public void Delete(Library library) { Log.Debug("Removing library to repository."); SessionFactory.GetCurrentSession().Delete(library); Log.Debug("Removing library to repository done."); }
public static Book CreateBook(Library library) { Random random = new Random(); return new Book(library, "80-200-0980-9") {Author = "Any author", Name = "Any name", Pages = random.Next()}; }
public void Add(Library library) { Log.Debug("Adding library to repository."); SessionFactory.GetCurrentSession().Save(library); Log.Debug("Adding library to repository done."); }