Skip to content

Instantly share code, notes, and snippets.

@hikalkan
Last active July 2, 2021 05:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hikalkan/caf54a092c929e4c558b to your computer and use it in GitHub Desktop.
Save hikalkan/caf54a092c929e4c558b to your computer and use it in GitHub Desktop.
Simple console application with ABP and EF.
[DependsOn(typeof(AbpEntityFrameworkModule))]
public class MyModule : AbpModule
{
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
}
}
class Program
{
static void Main(string[] args)
{
using (var bootstrapper = new AbpBootstrapper())
{
bootstrapper.Initialize();
var tester = IocManager.Instance.Resolve<Tester>();
tester.DoTests();
Console.WriteLine("Press enter to stop application...");
Console.ReadLine();
}
}
}
public class Tester : ITransientDependency
{
private IMyAppService _appService;
public Tester(IMyAppService appService)
{
_appService = appService;
}
public void DoTests()
{
//Use _appService here...
}
}
@hikalkan
Copy link
Author

Note: This code is written for ABP 0.4. Module code will be different for v0.3.2. See docs: http://www.aspnetboilerplate.com/Pages/Documents/Module-System

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment