To clarify my question. I understand that I need to keep the ABP XML localization and XML files for handling languages. I want to have a second localization service that will allow me to include the default Microsoft approach using individual resx files for each Razor page in NetCore 11 & Jquery.
How do you do this in 11 Mvc Core & Jquery?
Can we use resx files for our custom Entitues and screens following the Microsoft approach of using 1 resx file per screen? Is there a way of bypassing the ASPBoilerplate approach for our own screens? With 100 entities and 4+ CRUD screens per Entity, using the built-in approach where there is only one resx file for thousands of lines of translations is not possibel for us.
Thanks Romka. I added a new App Settings file called secrets.json it came with just a connectionstrings section so I just replaced the default connection string with the real one and the rest of the install was successful.
Here is a screen shot of 10.3 Net Core 5 Jquery showing the hardcoded value of 3. The initial install has no value for password length in the AbpSettings table. The first time you edit something on the Settings\Security page values get written to the AbpSettings table but then I can even set the password length to 1
16 2021-05-25 21:24:46.9635847 2 2021-05-25 21:27:40.7215188 2 Abp.Zero.UserManagement.PasswordComplexity.RequiredLength 1 NULL 1
The code is in \Admin\Controllers\UsersController.cs starting at line 79
I think this is the 10.3 code
public async Task<PartialViewResult> CreateOrEditModal(long? id)
{
var output = await _userAppService.GetUserForEdit(new NullableIdDto<long> {Id = id});
var viewModel = ObjectMapper.Map<CreateOrEditUserModalViewModel>(output);
viewModel.PasswordComplexitySetting = await _passwordComplexitySettingStore.GetSettingsAsync();
return PartialView("_CreateOrEditModal", viewModel);
}
This is the code from 8.5 and where we added the password length to the viewmodel \Admin\Controllers\UsersController.cs starting at line 77
[AbpMvcAuthorize(AppPermissions.Pages_Administration_Users_Create, AppPermissions.Pages_Administration_Users_Edit)]
public async Task<PartialViewResult> CreateOrEditModal(long? id)
{
var output = await _userAppService.GetUserForEdit(new NullableIdDto<long> { Id = id });
var viewModel = ObjectMapper.Map<CreateOrEditUserModalViewModel>(output);
viewModel.PasswordComplexitySetting = await _passwordComplexitySettingStore.GetSettingsAsync();
** viewModel.PasswordComplexitySetting.RequiredLength = 12;**
return PartialView("_CreateOrEditModal", viewModel);
}
A sloppy Tenant can create an incredibly unsafe site with these defaults. There should be a default minimum length should be something that can be edited in appsettings rather than having to rewrite core code to prevent Users from saving an unsafe password length to the database.
I haven't used the MultiSelect tool so I don't have an answer for you on that. I've found that the HtmlHelpers can be very finicky to configure to get them to work correctly especailly with handling Nulls and Telerik's documentation is poor.
For example:
Create for a DateTimePicker
@(Html.Kendo().DatePicker()
.Name("ContactDate")
.Value("")
.HtmlAttributes(new { placeholder = "month/day/year" })
)
Edit for a DateTimePicker
@(Html.Kendo().DatePicker()
.Name("ContactDate")
.Value(Model.ContactDate)
.HtmlAttributes(new { placeholder = "month/day/year" })
)
In Startup.cs ConfigureServices you need
.AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
That handles the Pascal Case/Camel Case issue
I have it right above IdentityRegistrar.Register(services);
Thanks for the reply. That had worked for me in 6.91. You are correct. It is not necessary to change the RenderSection. It should be
@RenderSection("Scripts", false)
Thanks, I looked at the MultipleDbContextEfCoreDemo but it isn't a full implementation of 7.0 (or maybe it is based a 6.x version) since there are classes in 7.0 (ex. EntityFrameworkCore\PredicateBuilder.cs and the EntityFrameworkCore\Repositories\TENENTNAME_RepositoryBase.cs classes which don't exist in the MultipleDbContextEfCoreDemo solution, so it isn't clear how to fully implement the MultipleDbContextEfCoreDemo approach in 7.0 and have the Repositories in the different DbContexts work.
It really would be helpful to see a full implementation ABP Implementation of this rather than a prooof of concept that touches two dummy classes and does not have all the necessary code to do this in Net Core 2.2
I've implemented all the classes from MultipleDbContextEfCoreDemo and run the application and the NetZero login pages work showing that it is connecting to the NetZero Database through the DbConnectionOptionsConfigurer but when I try and open the Index Razor page calling into my Second Database I get
HandlerException: Can't create component 'TENANTNAME.EntityFrameworkCore.SECONDDbContext' as it has dependencies to be satisfied. 'TENANTNAME.EntityFrameworkCore.SECONDDbContext' is waiting for the following dependencies: - Service 'Microsoft.EntityFrameworkCore.DbContextOptions`1[[TENANTNAME.EntityFrameworkCore.SECONDDbContext, OA_Tenant.EntityFrameworkCore, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
Here is my Razor Page code which obviously isn't seeing the SECONDDbContext
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using OA_Tenant.Applications.Entity; using OA_Tenant.EntityFrameworkCore; using Kendo.Mvc.Extensions; using Kendo.Mvc.UI;
namespace OA_Tenant.Web.Mvc.Areas.Applications.Pages.Interviews { public class IndexModel : PageModel { private readonly OA_Tenant.EntityFrameworkCore.SECONDDbContext _context;
public IndexModel(OA_Tenant.EntityFrameworkCore.SECONDDbContext context)
{
_context = context;
}
public IList<OA_Tenant.Applications.Entity.Interviews> Interviews { get;set; }
public async Task OnGetAsync()
{
Interviews = await _context.Interviews.ToListAsync();
}
In the MultipleDbContextEfCoreDemo the only DbContext registered in Startup is DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
In my Startup I have
services.AddAbpDbContext<FIRSTDbContext>(options =>
{
FIRSTDbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
});
I tried registering the Second DbContext but that also fails
services.AddAbpDbContext<SECONDDbContext>(options =>
{
ApplicationsDbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
});
Also, I am not sure how to be able to use all my SecondDbContext Repositories since the RepositoryBase class references the FIRST/ORIGINAL DbContext.
public abstract class TENANTNAMERepositoryBase<TEntity, TPrimaryKey> : EfCoreRepositoryBase<TENANTNAMEDbContext, TEntity, TPrimaryKey> where TEntity : class, IEntity
protected OA_TenantRepositoryBase(IDbContextProvider<TENANTNAMEDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
In my case there are three separate databases (Applications, Programs, Trips) that I will need to connect to from the same Tenant. The built-in structure seems like it stores 1 additional connection string somewhere in an Abp-Table in the database. Does this method allow for more than 1 additional connection string per Tenant? Also, does this use a separate DbContext for the additional databases or is there 1 DbContext for everything? I would prefer to use separate DbContexts.