forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIEntityNotFoundDelegate.cs
41 lines (39 loc) · 1.33 KB
/
IEntityNotFoundDelegate.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
namespace NHibernate.Proxy
{
//6.0 TODO Add to IEntityNotFoundDelegate interface
internal static class EntityNotFoundDelegateExtension
{
/// <summary>
/// Method to handle the scenario of an entity not found by unique key.
/// </summary>
/// <param name="interceptor"></param>
/// <param name="entityName">The entityName (may be the class fullname)</param>
/// <param name="propertyName">Property name</param>
/// <param name="key">Key</param>
public static void HandleEntityNotFound(
this IEntityNotFoundDelegate interceptor,
string entityName,
string propertyName,
object key)
{
if (interceptor is Impl.SessionFactoryImpl.DefaultEntityNotFoundDelegate x)
{
x.HandleEntityNotFound(entityName, propertyName, key);
return;
}
new Impl.SessionFactoryImpl.DefaultEntityNotFoundDelegate().HandleEntityNotFound(entityName, propertyName, key);
}
}
/// <summary>
/// Delegate to handle the scenario of an entity not found by a specified id.
/// </summary>
public interface IEntityNotFoundDelegate
{
/// <summary>
/// Delegate method to handle the scenario of an entity not found.
/// </summary>
/// <param name="entityName">The entityName (may be the class fullname)</param>
/// <param name="id">The requested id not founded.</param>
void HandleEntityNotFound(string entityName, object id);
}
}