Database problem #1531
-
So as I am getting a project ready for deployment I wanted to test with a fresh database so I changes my connection string and I'm not sure exactly what is happening and hoping someone can either help or spot something I missing. The problem is that the identity tables don't seem to be getting created without having to add 'Piranha.AspNetCore.Identity.IDb db' to the configure method of my startup class. The identity tables are then made but not all the claims are made and so can't login to the manager. I have stripped out everything else in the startup class and I am left with this public class Startup
{
private readonly IConfiguration _config;
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="configuration">The current configuration</param>
public Startup(IConfiguration configuration)
{
_config = configuration;
}
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
// Service setup
services.AddPiranha(options =>
{
options.AddRazorRuntimeCompilation = true;
options.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames);
options.UseImageSharp();
options.UseManager();
options.UseTinyMCE();
options.UseMemoryCache();
options.UseEF<SQLServerDb>(db =>
db.UseSqlServer(_config.GetConnectionString("piranha")));
options.UseIdentityWithSeed<IdentitySQLServerDb>(db =>
db.UseSqlServer(_config.GetConnectionString("piranha")));
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApi api)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// Initialize Piranha
App.Init(api);
// Build content types
new ContentTypeBuilder(api)
.AddAssembly(typeof(Startup).Assembly)
.Build()
.DeleteOrphans(); ;
// Configure Tiny MCE
EditorConfig.FromFile("editorconfig.json");
// Middleware setup
app.UsePiranha(options => {
options.UseManager();
options.UseTinyMCE();
options.UseIdentity();
});
}
} Here is a picture of the tables made without adding 'Piranha.AspNetCore.Identity.IDb db' to the startup configure Once added this is the tables made But the only RoleClaims added are as follows I have tested a few times and only once has all the claims been created and I can't seem to reproduce this now. Any help or thought would be greatly appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Never mind silly mistake on my behalf didn't realise that the claims are only made once you login to the manger. Tried to delete this question but couldn't so feel free to remove it @tidyui |
Beta Was this translation helpful? Give feedback.
Never mind silly mistake on my behalf didn't realise that the claims are only made once you login to the manger. Tried to delete this question but couldn't so feel free to remove it @tidyui