Skip to content

Commit

Permalink
Added RegisterAssembly overload.
Browse files Browse the repository at this point in the history
  • Loading branch information
dicky authored and dicky committed Dec 8, 2017
1 parent 5892c9c commit 02652a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions DotNetifyLib.Core/DotNetifyConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public class DotNetifyConfiguration : IDotNetifyConfiguration
/// <summary>
/// Register view model classes in an assembly that are subtypes of BaseVM.
/// </summary>
public void RegisterAssembly(Assembly assembly) => VMController.RegisterAssembly<BaseVM>(assembly);
public void RegisterAssembly(Assembly assembly) => VMController.RegisterAssembly(assembly);

/// <summary>
/// Register view model classes in an assembly that are subtypes of BaseVM.
/// </summary>
public void RegisterAssembly(string assemblyName) => VMController.RegisterAssembly<BaseVM>(Assembly.Load(new AssemblyName(assemblyName)));
public void RegisterAssembly(string assemblyName) => VMController.RegisterAssembly(Assembly.Load(new AssemblyName(assemblyName)));

/// <summary>
/// Register view model classes in an assembly that are subtypes of a certain type.
Expand Down Expand Up @@ -79,7 +79,12 @@ public IDotNetifyConfiguration Register(string typeName, Func<object[], INotifyP
/// <summary>
/// Registers view model classes in the entry assembly.
/// </summary>
public void RegisterEntryAssembly() => VMController.RegisterAssembly<BaseVM>(Assembly.GetEntryAssembly());
public void RegisterEntryAssembly()
{
var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly != null)
VMController.RegisterAssembly(entryAssembly);
}

/// <summary>
/// Whether anything has been registered.
Expand Down
6 changes: 6 additions & 0 deletions DotNetifyLib.Core/VMController.Registration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public partial class VMController

#endregion

/// <summary>
/// Registers all view model types in an assembly.
/// </summary>
/// <param name="vmAssembly">Assembly.</param>
public static void RegisterAssembly(Assembly vmAssembly) => RegisterAssembly<BaseVM>(vmAssembly);

/// <summary>
/// Registers all view model types in an assembly.
/// </summary>
Expand Down

0 comments on commit 02652a5

Please sign in to comment.