Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "statuscast"

Question

Hi,

Is there a working or up to date document that walks thru the set up of a second database / dbcontext? We have high-transaction / high-volume data we do not want to store in to main tenant databases and prefer to offload it to a secondary db. The most current information I can find is this:

https://stackoverflow.com/questions/49243891/how-to-use-multiples-databases-in-abp-core-zero

But even that looks out of date relative to the current project structure of 6.1.

Any updated documentation or working sample project that is compatible with 6.1?

This does not work either. Did you try this or just ask me to try it?

AspNetZero is doing something somewhere that prevents a the basic override. If this didn't work in AspNetBoilerPlate I would think this was architecturally buried somehwere that AZ couldn't control. But this is definitely an AZ issue. Can we get it moved in to the Git issues if no one has a way to resolve?

It's severly limiting -- the only work around is to build our own separate repository for 1 configuration value.

This does not work either. Did you try this or just ask me to try it?

AspNetZero is doing something somewhere that prevents a the basic override. If this didn't work in AspNetBoilerPlate I would think this was architecturally buried somehwere that AZ couldn't control. But this is definitely an AZ issue. Can we get it moved in to the Git issues if no one has a way to resolve?

It's severly limiting -- the only work around is to build our own separate repository for 1 configuration value.

No, it doesn't.

Guys -- all you have to do is add this one line of code to EntityFrameworkCore\StatusCastDbContext.cs in OnModelCreating:

protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
         
            //Increase your Setting Value 
            modelBuilder.Entity<Abp.Configuration.Setting>().Property(u => u.Value).HasColumnType("nvarchar(max)");
            modelBuilder.Entity<Abp.Application.Editions.Edition>().Property(u => u.DisplayName).HasColumnType(("nvarchar(max)"));
            

Can you please just give it a try and see why it isn't working rather than randomly closing this issue on me, or telling me to fix it in ways that aren't even possible. I really need some resolution on this as your column sizes for the Settings table is artificially way too small. As I've pointed out, this works perfectly in AspNetZero.

Here's a video of what I'm doing from downloading the template from my account to making the change: https://drive.google.com/file/d/1S4yNKa3oLAxUiEzX_4S9ln5mBeQ7z2DB/view?usp=sharing

thank you.

Hi there,

Any update on this? Not being able to modify the settings table in AZ is concerning, especially since it seems somehow code in my OnModelCreating is being ignored or overwritten. We are at the beginning of a large project where I'm sure other things in this section are going to be required.

Also, why is work properly in AspNetBoilderPlate but not AspNetZero is still confusing.

I don't seem to be seeing the exception anymore, so it looks like we are all set. Thanks!

Hi there,

Since it wasn't a bug, just a question, I originally posted it in StackExchange, per their request:

https://stackoverflow.com/questions/51390090/extend-size-of-settings-value-beyond-2-000-characters

It's very odd because I see the code being hit when I debug, but its completely ignored or overwritten by something in AspNetZero. It works perfectly in my ABP sample project.

ok so first of all, as I mentioned and the code above shows, I am trying to override the ABP Settings.Value property length so I dont have the ability to just 'set it as a string'.

I posted this problem to ABP a while ago and the solution they suggested, which works, is the above code I posted.

It does not work in ASPNETZERO however.

Simply pointing me to basic Microsoft EF documentation without taking the time to read my problem and then closing this question is not helpful.

How does that get me varchar(max)?

I need this to not have a fixed length. Was doing it successfully in Abp.

why does this work in Abp but not AZ?

Hi,

In Abp we can change the default length of the AbpSettings column by adding this line of code to the EntityFramework.Core\EntityFrameworkCore\CompanyNameDbContext.cs:

 protected override void OnModelCreating(ModelBuilder modelBuilder)
  {
      base.OnModelCreating(modelBuilder);

     //Increase your Setting Value to 4000 chars (translates to NVARCHAR(MAX) 
     modelBuilder.Entity<Abp.Configuration.Setting>().Property(u => u.Value).HasColumnType("nvarchar(max)");

However, in AZ this line of code seems to have no effect. The DB is still being created with column width of 2000. Does this code have to sit in a dfferent project in AspNetZero? We put this line of code in, rebuilt, blew away the database, then run Update-Databse to ensure it was not working.

Showing 31 to 40 of 52 entries