Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public void Delete(Library library) {
     Log.Debug("Removing library to repository.");
     SessionFactory.GetCurrentSession().Delete(library);
     Log.Debug("Removing library to repository done.");
 }
Exemplo n.º 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()};
 }
Exemplo n.º 4
0
 public void Add(Library library) {
     Log.Debug("Adding library to repository.");
     SessionFactory.GetCurrentSession().Save(library);
     Log.Debug("Adding library to repository done.");
 }