Generation of ID in Entity Framework’s IdentityUser

This is a personal reminder that default IdentityUser and its friends (like IdentityRole) generate the ID value in its constructor. These classes extend the behavior of the generic classes (IdentityUser implements IdentityUser<TKey, …> with IdentityUser<string, …>). If you happen to use your own class that inherits from them, you’ll be responsible for generating that ID. Otherwise, you’ll get an error like the following: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column ‘Id’ table ‘dbo.AspNetUsers’; column does not allow nulls. INSERT fails. The statement has been terminated. IdentityUser implementation IdentityUser: Microsoft Docs | Code at Github (aspnet/Identity) IdentityUser<TKey, TLogin, TRole, TClaim> : Microsoft Docs | Code at Github (aspnet/Identity) IdentityRole implementation IdentityRole:… Read More

Continue Reading

Debug mobile app in both mobile and computer

While we are developing a mobile app that talks to an API on our own, we may want to just put a breakpoint in an API call and see what happens. Although the best way to test and API is with programs like Postman, there are occasions where we need some context about when a call is made and for what reason. This looks difficult considering the fact that we are developing the API in the computer’s localhost, which is different than mobile’s localhost. We usually have an intuition here because we think that, being in the same network, there should be a way to access the computer. If you… Read More

Continue Reading