ASP.NET 6 Gotchas…
- entity framework migrations only work with classname plis a suffix of id as table id, otherwise, an error… (BY DEFAULT…)
- do not mix services.AddTransient<AccountService>(); instances with services.AddSingleton<IAccountRepository, AccountRepository>(); services for dependence injection.they result to some funny exception without proper details
- package management is easier but with wierd errors upon upgrade or adding a new package, like:
http://openstackwiki.org/wiki/ASP.Net5_Startup.cs_ConfigurationBuilder
- there is no bearer tokens, but i suppose they are working on that. you only got Cookies…
- wwwroot is not a normal folder, so you cant include it i your scripts or styles reference
- how to configure mvc default routing
you have to do the following…
routes.MapRoute(
name: “default”,
template: “{index?}”,
defaults: new { controller = “Home”, action = “Index” }
);
and use the following controller
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
[Route(“about”)]
public IActionResult About()
{
ViewData[“Message”] = “Your application description page.”;
return View();
}
[Route(“contact”)]
public IActionResult Contact()
{
ViewData[“Message”] = “Your contact page.”;
return View();
}
}
}
this will serve the following urls:
also, the above will handle unavailable routes without the cost of redirecting, eg, http://localhost:3453/404 will show the page in http://localhost:3453/ given the route http://localhost:3453/404 isnt specified.
- Ajax and cookies are not good friends…
ASP.NET 6 Gotchas… Read More ยป