public void Save(Author author)
 {
     IRepository repository = RepositoryFactory.GetRepository<IRepository>();
     try
     {
         repository.BeginTransaction();
         author.Contract = true;
         repository.Add<Author>(author);
         //repository.Attach<Author>(author);
         repository.SaveChanges();
         repository.CommitTransaction();
     }
     catch (Exception ex)
     {
         repository.Rollback();
         throw;
     }
     finally { repository.Dispose(); }
 }
Beispiel #2
0
 public virtual void AddAuthors(Author author)
 {
     author.AddTitles(this);
     this.Authors.Add(author);
 }