Skip to content

Commit f0c7399

Browse files
committed
Safeguards and GetHashCode implementation
1 parent 40adca5 commit f0c7399

File tree

1 file changed

+41
-28
lines changed

1 file changed

+41
-28
lines changed
Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Reflection;
43
using System.Linq;
4+
using System.Reflection;
55
using FluentNHibernate.Diagnostics;
66

77
namespace FluentNHibernate
88
{
9-
/// <summary>
10-
/// Facade over an assembly for retrieving type instances.
11-
/// </summary>
12-
public class AssemblyTypeSource : ITypeSource
13-
{
14-
private readonly Assembly source;
15-
16-
public AssemblyTypeSource(Assembly source)
17-
{
18-
this.source = source;
19-
}
20-
21-
public IEnumerable<Type> GetTypes()
22-
{
23-
return source.GetTypes().OrderBy(x => x.FullName);
24-
}
25-
26-
public void LogSource(IDiagnosticLogger logger)
27-
{
28-
logger.LoadedFluentMappingsFromSource(this);
29-
}
30-
31-
public string GetIdentifier()
32-
{
33-
return source.GetName().FullName;
34-
}
35-
}
9+
/// <summary>
10+
/// Facade over an assembly for retrieving type instances.
11+
/// </summary>
12+
public class AssemblyTypeSource : ITypeSource
13+
{
14+
readonly Assembly source;
15+
16+
public AssemblyTypeSource(Assembly source)
17+
{
18+
if (source == null) throw new ArgumentNullException("source");
19+
20+
this.source = source;
21+
}
22+
23+
#region ITypeSource Members
24+
25+
public IEnumerable<Type> GetTypes()
26+
{
27+
return source.GetTypes().OrderBy(x => x.FullName);
28+
}
29+
30+
public void LogSource(IDiagnosticLogger logger)
31+
{
32+
if (logger == null) throw new ArgumentNullException("logger");
33+
34+
logger.LoadedFluentMappingsFromSource(this);
35+
}
36+
37+
public string GetIdentifier()
38+
{
39+
return source.GetName().FullName;
40+
}
41+
42+
#endregion
43+
44+
public override int GetHashCode()
45+
{
46+
return source.GetHashCode();
47+
}
48+
}
3649
}

0 commit comments

Comments
 (0)