Skip to content

Instantly share code, notes, and snippets.

@surgicalcoder
Created March 20, 2017 14:49
Show Gist options
  • Select an option

  • Save surgicalcoder/11897ac73354c58255fda4d13a28d5a2 to your computer and use it in GitHub Desktop.

Select an option

Save surgicalcoder/11897ac73354c58255fda4d13a28d5a2 to your computer and use it in GitHub Desktop.
Hack for adding MVC Core modules dynamically
public class Blarg : ApplicationPart, IApplicationPartTypeProvider, ICompilationReferencesProvider
{
public Assembly Assembly { get; }
public Blarg(Assembly assembly)
{
if (assembly == (Assembly)null)
throw new ArgumentNullException("assembly");
this.Assembly = assembly;
}
public override string Name
{
get
{
return this.Assembly.GetName().Name;
}
}
/// <inheritdoc />
public IEnumerable<TypeInfo> Types
{
get
{
return this.Assembly.DefinedTypes;
}
}
public IEnumerable<string> GetReferencePaths()
{
return Enumerable.Empty<string>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment