1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.Facilities
.NHibernateIntegration
.Tests
.Transactions
19 using Castle
.Services
.Transaction
;
25 public class SecondDao
27 private readonly ISessionManager sessManager
;
29 public SecondDao(ISessionManager sessManager
)
31 this.sessManager
= sessManager
;
35 public virtual BlogItem
Create(Blog blog
)
37 using(ISession session
= sessManager
.OpenSession())
39 NUnit
.Framework
.Assert
.IsNotNull(session
.Transaction
);
41 BlogItem item
= new BlogItem();
43 item
.ParentBlog
= blog
;
44 item
.ItemDate
= DateTime
.Now
;
46 item
.Title
= "splinter cell is cool!";
55 public virtual BlogItem
CreateWithException(Blog blog
)
57 using(ISession session
= sessManager
.OpenSession())
59 NUnit
.Framework
.Assert
.IsNotNull(session
.Transaction
);
61 BlogItem item
= new BlogItem();
63 item
.ParentBlog
= blog
;
64 item
.ItemDate
= DateTime
.Now
;
66 item
.Title
= "splinter cell is cool!";
68 throw new NotSupportedException("I dont feel like supporting this");
73 public virtual BlogItem
CreateWithException2(Blog blog
)
75 using(ISession session
= sessManager
.OpenSession())
77 NUnit
.Framework
.Assert
.IsNotNull(session
.Transaction
);
79 BlogItem item
= new BlogItem();
81 item
.ParentBlog
= blog
;
82 item
.ItemDate
= DateTime
.Now
;
84 item
.Title
= "splinter cell is cool!";
88 throw new NotSupportedException("I dont feel like supporting this");