I have ported my NetZero 6.91 Net Core 2.2 jQuery app over to 8.1 Net Core 3.1 jQuery here are a few tips for getting Kendo UI to work. Hope this is helpful.
PROJECTNAME.Web.Mvc\Startup\Startup.cs
using Newtonsoft.Json.Serialization;
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// MVC
services.AddControllersWithViews(options =>
{
options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
})
#if DEBUG .AddRazorRuntimeCompilation() #endif
//Added for Kendo Serialization
.AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
//Further down in file
services.AddKendo();
The Kendo JS files need to be loaded in the header - https://docs.telerik.com/kendo-ui/intro/installation/hosting-kendoui
Make changes to your _Layout.cshtml file Areas\Admin\Views\Layout__Layout.cshtml
HEADER - Add style sheets and javascript <link rel="stylesheet" type="text/css" href="~/lib/kendo-ui/styles/web/kendo.common-material.min.css" /> <link rel="stylesheet" type="text/css" href="~/lib/kendo-ui/styles/web/kendo.material.min.css" />
Take the entire NetZero Scripts section that is at the bottom of the page between the <!--begin::Base Scripts --> tags and move it up into the header
<!--begin::Base Scripts -->
ALL THE NETZERO SCRIPTS
<!-- Add the Kendo JS at the end of the scripts section so it is called after jQuery has loaded -->
<script src="~/lib/kendo-ui/js/kendo.all.min.js"></script>
<script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
<!--end::Base Scripts -->
~~
EDITED: NOT NECESSARY
Find the section for RenderSection("Scripts - it is right after <!--begin::Page Snippets -->
Change to true
~~ <!--begin::Page Snippets --> @RenderSection("Scripts", true) <!-- Change to true to handle scripts being placed in the header -->~~~~
We are moving from 6.9 to 8.1 ASP.NET Core 3.1 Jquery to take advantage of the new features of both ABP and NetCore 3.1. We have standard CRUD operations happening on the Web App that uses ABP Authentication. We also have built a Blazor Client App for CREATE ONLY operations for Anonymous Users (one ABP User Account that can be logged in to and accessed by multiple people simultaneously).
For the Web App security and the user license count we want to equire 2FA and prevent Concurrent Login, but we want to DISABLE this for the Anonymous User account since we want multiple people to be able to add data without bumping someone else off the system and, since they are Anonymous, we don't have either cellphone number or email and therefore can't use 2FA.
Currently it seems that Concurrent Login and 2FA configuration is only available to the SuperAdmin and applies universally to all Tenants.
How would you implement these at the User Level. Our goal would be the default setting from the Settings/Security screen would be the default and inherited by all Users (and be part of the Create/Edit User screen) so that it could be turned off at the User Account level.
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.
I am working with ABP 7.0.0 Asp Net Core 2.2 & Jquery using NetZero as the Authentication layer to access several different databases that, for business purposes, must be kept separate from the ABP Database. Each of my other databases has all of the required ABP Fields to be fully IMustHaveTenant compatible. Once logged in TenantId, User, Role is in Session and should be able to be passed to the other databases.
I've looked at various forum posts and Github code for having multiple databases and more than one DbContext pointing to different connection strings but I haven't been able to get those approached to work in Net Core 2.2. Has anyone gotten this scenario to work in Net Core 2.2? I would appreciate seeing
I would, respectfully, disagree with the assertion that ANZ is not a professional level product. What they sell is source code plain and simple and they are up front about what they are selling. Having built a lot of software over the past 20 years and paid other developers a lot of money to write code for me, there is no way that I could get the breadth of what the ANZ folks have built by paying an outside developer just $2500. From scratch would be in the Tens of Thousands of dollars US range. I am happy for what I have paid for since it was much less expensive than anything else I could have paid a developer to code. The quality of the code is also very good. I've had multiple top developers work with it and they have been impressed with the code quality.
I too wish that upgrading was something that was an option because when they release a improvement, I am left in the dust which is disappointing. But that does not mean that ANZ is not a professional grade product. In moving from the MVC Jquery version to the Net Core Jquery version I spent a lot of time documenting where my code fit in with theirs to make an upgrade process more feasible. I believe that there are some things that they could do with their code that would make it easier to upgrade:
There are several things to understand about ASPNETZERO. It is built as a framework to create your Web app on top off and as an upgradable product. They've done a ton of the heavy lifting for you with authentication, authorization, etc. They don't say that there is an upgrade path (although there are some ways to branch that you can find in this forum).
In the case of 6.9 to 7.0 it is a very big UI change since they updated the underlying Metronic theme system (www.keenthemes.com) from the 5.x version to 6.0. That means you would need to change lots in the layout.cshtml files across the entire application.
Very helpful post. One thing I would add for Telerik ASP.NET Core Jquery with Netzero Core 2.2
I found that the Telerik js files need to be in the header rather than at the bottom of the page to work so on the NetZero /Area/Views/Layouts/__Layout.cshtml
I moved the script code up into the header AND there is a Netzero RenderScript flag in the footer which is set to false by default, change this to true when moving the Script Code to the Header
@RenderSection("Scripts", true)
Here is the Code I moved to the header
`
<!-- Dynamic scripts of ABP system (They are created on runtime and can not be bundled) -->
<script src="@(ApplicationPath)AbpServiceProxies/GetAll?v=@(AppTimes.StartupTime.Ticks)" type="text/javascript"></script>
<script src="@(ApplicationPath)AbpScripts/GetScripts?v=@(AppTimes.StartupTime.Ticks)" type="text/javascript"></script>
<script type="text/javascript">
abp.localization.currentCulture = $.extend({}, abp.localization.currentCulture, { displayNameEnglish: '@CultureInfo.CurrentUICulture.EnglishName' });
moment.locale('@(CultureHelper.UsingLunarCalendar ? "en": CultureInfo.CurrentUICulture.Name )'); //Localizing moment.js
</script>
<script src="@(ApplicationPath)view-resources/Areas/Admin/Views/_Bundles/signalr.bundle.min.js" asp-append-version="true"></script>
<script abp-src="/view-resources/Areas/Admin/Views/_Bundles/common-scripts.js" asp-append-version="true"></script>
<script abp-src="/view-resources/Areas/Admin/Views/_Bundles/app-common-scripts.js" asp-append-version="true"></script>
<script abp-src="/view-resources/Areas/Admin/Views/Layout/_Header.js" asp-append-version="true"></script>
<script src="@(ApplicationPath)view-resources/Areas/Admin/Views/Layout/_ThemeSelectionPanel.js" asp-append-version="true"></script>
@if (isChatEnabled)
{
<script src="@(ApplicationPath)view-resources/Areas/Admin/Views/Layout/_ChatBar.js" asp-append-version="true"></script>
<script src="@(ApplicationPath)Common/Scripts/Chat/chat.signalr.js" asp-append-version="true"></script>
}
<script src="[email protected]_Validation_Localization" asp-append-version="true"></script>
<script src="[email protected]_Select_Localization" asp-append-version="true"></script>
<script src="[email protected]_Timeago_Localization" asp-append-version="true"></script>
<script src="[email protected]_Localization" asp-append-version="true"></script>
<!--end::Base Scripts -->
<!--begin::Telerik Scripts -->
<!-- NOTE Jquery already loaded as part of NetZero Bundles above-->
** ** `
I appreciate all the fantastic work that the ASP.NET Zero Team has put into this framework. CSS Theme development is it's own specialty which requires experience in graphic design and UI. I've built dozens of Web apps and while I'm a good programmer, I'm not a graphic designer and I rely on commercial Theme packages to deliver a really good looking final package which I could never build myself. With a framework this complex and robust, I look to the ASP.NET Zero Team to deliver excellent NET Code and understand the need to utilize CSS Themes.
I had this same issue while developing locally. I spent 8 hours on Saturday coding, building and testing and 6 hours on Sunday - absolutely no problems. Then after one build it threw this same error. I had never touched any code related to the friend service. I ended up rebooting my computer (which showed a memory error on shutdown). When I restarted and built my solution again, the problem was gone. Three more hours of building and testing - no problem. Memory leak?