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…
Advertisements

About Kabue Charles

I am an instigator of artistic, intelligent and mind boggling softwares. I love C#, envy C++, and one day I might try CUDA. I prefer solving complex and mission impossible problems in a new or old but innovative way. Am intrigued by machine learning challenges, security critical challenges, and privacy challenges like a real serverless peer-to-peer communication. I am usually literally stressed when a day goes by without learning or doing something new. I avoid repetition whenever possible. Away from computers, I enjoy capturing moments of life and nature with 1080 (…and above) pixel pictures and videos. I like details, accuracy, idealistic but realistic personalities. I love futurist’s but I hate fantasy. A decent, moderate and gentle character is my favorite. I avoid shame like a plague, confront my fears with facts, and I am very constant with opinions and beliefs. I love suits (…but don’t wear them), arsenal football club (…I only know the manager), and I have no favorite food. Reading and writing poems helps me retain my sobriety. I consider myself funny, privileged, a renaissance man and sometimes shy. I believe in things unseen and incomprehensible.

Posted on December 1, 2015, in ASP.NET 6, Learning and tagged . Bookmark the permalink. Leave a comment.

Say Something....

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: