Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Facilities / NHibernateIntegration / Castle.Facilities.NHibernateIntegration.Tests / Transactions / Model / SecondDao.cs
blobfafd6466ade58dc69b148e7bdfdf9ed7ab1fafad
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
19 using Castle.Services.Transaction;
21 using NHibernate;
24 [Transactional]
25 public class SecondDao
27 private readonly ISessionManager sessManager;
29 public SecondDao(ISessionManager sessManager)
31 this.sessManager = sessManager;
34 [Transaction]
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;
45 item.Text = "x";
46 item.Title = "splinter cell is cool!";
48 session.Save(item);
50 return item;
54 [Transaction]
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;
65 item.Text = "x";
66 item.Title = "splinter cell is cool!";
68 throw new NotSupportedException("I dont feel like supporting this");
72 [Transaction]
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;
83 item.Text = "x";
84 item.Title = "splinter cell is cool!";
86 session.Save(item);
88 throw new NotSupportedException("I dont feel like supporting this");