ASP.NET 6 Gotchas…

  1. entity framework migrations only work with classname plis a suffix of id as table id, otherwise, an error… (BY DEFAULT…)
  2. 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
  3. package management is easier but with wierd errors upon upgrade or adding a new package, like:

http://stackoverflow.com/questions/33180380/error-iconfigurationprovider-claims-it-is-defined-in-microsoft-framework-conf/33196496

http://openstackwiki.org/wiki/ASP.Net5_Startup.cs_ConfigurationBuilder

  1. there is no bearer tokens, but i suppose they are working on that. you only got Cookies…
  2. wwwroot is not a normal folder, so you cant include it i your scripts or styles reference
  3. 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:

http://localhost:3453/

http:localhost:3453/index

http:localhost:3453/about

http:localhost:3453/contact

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.

  1. Ajax and cookies are not good friends…

ASP.NET 6 Gotchas… Read More ยป