2
In an ASP.Net MVC application I need to have a default user record and for that I am thinking of adding it on startup of the application.
In the archive Global.asax
I did the following:
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
// Registradores ...
// Comando para setar os registros básicos
App_Start.DatabaseConfig.SetDataDefault();
}
}
And in class DataBaseConfig
I have:
public static void SetDataDefault()
{
using (var ctx = new Data.Context.ApplicationDbContext())
{
// Outras adições simples ...
if (!ctx.Users.Any())
{
// Adiciona o usuário padrão
... // Oo heim.. !!??
}
}
}
How to proceed to add a user at this time, judging that I need to get an instance of ApplicationUserManager
to register the user?