Skip to content

Commit

Permalink
Scan only explicitly specified assemblies
Browse files Browse the repository at this point in the history
  • Loading branch information
yevhen committed Aug 1, 2017
1 parent abbb0ca commit f146302
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Source/Orleankka/Core/ActorInterfaceMapping.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace Orleankka.Core
{
class ActorInterfaceMapping : IEquatable<ActorInterfaceMapping>
{
public static ActorInterfaceMapping Of(string typeName) => new ActorInterfaceMapping(typeName, null, null);

public static ActorInterfaceMapping Of(Type type)
public static ActorInterfaceMapping Of(Type type, IEnumerable<Assembly> assemblies)
{
var name = ActorTypeName.Of(type);

Expand All @@ -22,7 +24,7 @@ public static ActorInterfaceMapping Of(Type type)

if (type.IsInterface)
{
var classes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()
var classes = assemblies.SelectMany(a => a.GetTypes()
.Where(x => x.IsClass && type.IsAssignableFrom(x)))
.ToArray();

Expand Down
2 changes: 1 addition & 1 deletion Source/Orleankka/Core/ActorInterfaceRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal void Register(Assembly[] assemblies, Func<Assembly, IEnumerable<Type>>

foreach (var type in assemblies.SelectMany(selector))
{
var mapping = ActorInterfaceMapping.Of(type);
var mapping = ActorInterfaceMapping.Of(type, assemblies);

if (interfaces.Contains(mapping.TypeName))
{
Expand Down

0 comments on commit f146302

Please sign in to comment.