public async void myFirstMethod() { Console.WriteLine("Testing"); //Task.Run(() => _anotherService.callMe()); Thread thread = new Thread(delegate() { var options = new DbContextOptionsBuilder <Repository.Repository.BloggingContext>(); options.UseSqlite("Data Source=caraii_borracha.db"); using (var db = new Repository.Repository.BloggingContext(options.Options)) { AnotherService another = new AnotherService(db); another.callMe(); } }); thread.Start(); thread.Join(); Console.WriteLine("Terminou o trem"); }
public AnotherService(Repository.Repository.BloggingContext context) { _context = context; }