forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectionReleaseMode.cs
44 lines (41 loc) · 1.05 KB
/
ConnectionReleaseMode.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
namespace NHibernate
{
public enum ConnectionReleaseMode
{
AfterStatement,
AfterTransaction,
OnClose
}
public static class ConnectionReleaseModeParser
{
public static ConnectionReleaseMode Convert(string value)
{
switch (value)
{
case "after_statement":
throw new HibernateException("aggressive connection release (after_statement) not supported by NHibernate");
case "after_transaction":
return ConnectionReleaseMode.AfterTransaction;
case "on_close":
return ConnectionReleaseMode.OnClose;
default:
throw new HibernateException("could not determine appropriate connection release mode [" + value + "]");
}
}
public static string ToString(ConnectionReleaseMode value)
{
switch (value)
{
case ConnectionReleaseMode.AfterStatement:
return "after_statement";
case ConnectionReleaseMode.AfterTransaction:
return "after_transaction";
case ConnectionReleaseMode.OnClose:
return "on_close";
default:
throw new ArgumentOutOfRangeException("value");
}
}
}
}