Пример #1
0
        /// <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);
        }
Пример #2
0
 public void Delete(Library library) {
     Log.Debug("Removing library to repository.");
     SessionFactory.GetCurrentSession().Delete(library);
     Log.Debug("Removing library to repository done.");
 }
Пример #3
0
 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()};
 }
Пример #4
0
 public void Add(Library library) {
     Log.Debug("Adding library to repository.");
     SessionFactory.GetCurrentSession().Save(library);
     Log.Debug("Adding library to repository done.");
 }