Hello, guys! I have the following scenario:
One application developed using aspnetzero .net core 1.1 and another application developed using aspnetzero .net core 2. What we need to do now is merge these two applications database into one. Both have different schemas, except for the Abp tables. We want to merge Tenants, Users, Roles, etc so we can have a portal login and the applications are being accessed without having to authenticate again.
I thought of two ways of doing this:
1 - Just set up the connection string of the first application to the second application's database and let the migration do the work of creating new tables, etc. But I am afraid that the .net core version may cause any problem.
2 - Use SQL Service Integration Service to do the work merging the data.
Do you have any clue of which way would be safer and quicker to apply?
Thanks in advance!
Is there a way to define a filter a value coming from an inputDto? I need the inputdto value to be specified in an API.
I tried all the options of the link [http://www.aspnetboilerplate.com/Pages/Documents/Data-Filters]) and the official github [https://github.com/jcachat/EntityFramework.DynamicFilters]), but I can not.
Hello guys,
I'm thinking of building a structure for external repositories to consume xml and json, however I would like to know if anyone here has already done this or have any ideas whatsoever to preserve an aspnetzero structure?
Thank you.
Hi,
In the latest version of AspNetZero, version 1.13.0.0, if i set the MultiTenancy to false, my application permissions are not created in the Tests project when the seed is executed.
public abstract class AppTestBase : AbpIntegratedTestBase<MyModule>
{
protected AppTestBase()
{
// Here when MultiTenancy is false, TenantId can't be assigned to null, consequently this is will cause a problem in the seed methods. I'm going to explain in another piece of code
AbpSession.TenantId = null;
}
}
The real problems in Seed methods: Take a look in the coments to understand what is happening 1)
public class HostRoleAndUserCreator
{
private void CreateHostRoleAndUsers()
{
//Admin role for host
var adminRoleForHost = _context.Roles.FirstOrDefault(r => r.TenantId == null && r.Name == StaticRoleNames.Host.Admin);
if (adminRoleForHost == null)
{
adminRoleForHost = _context.Roles.Add(new Role(null, StaticRoleNames.Host.Admin, StaticRoleNames.Host.Admin) { IsStatic = true, IsDefault = true });
_context.SaveChanges();
// After saving the changes the adminRoleForHost.TenantId will be set to 1 even we have passed null to the constructor parameter because AbpSession.TenantId is 1 and not null
}
}
}
public class TenantRoleAndUserBuilder
{
private void CreateRolesAndUsers()
{
//Admin role
// Here this query will find the admin role to TenantId == 1, so the seed won´t generated my permissions needed to run my tests (i mean the tests not created by aspnetzero template by default)
var adminRole = _context.Roles.FirstOrDefault(r => r.TenantId == _tenantId && r.Name == StaticRoleNames.Tenants.Admin);
if (adminRole == null)
{
// Here is generated the permissions
...
}
}
}
The workaround that I've created is to set MultiTenancy to true like this:
protected AppTestBase()
{
// ....
var multiTenancy = Resolve<IMultiTenancyConfig>();
if (!multiTenancy.IsEnabled)
{
multiTenancy.IsEnabled = true;
}
// ....
}
Maybe that issue is a bug in TestAbpSession?
Thanks.
Is there any way to debug the abp 1.x.x.x ? I tried to do the following:
But looks like VS is not allowing to use the namespaces of abp source in the project.
Am i doing something wrong? Or is that not possible?
Thanks!
Hi,
EF DynamicFilter versions 2.3.x or 2.4.x has a bug when entities mappings are done like this:
public class CustomUserPermissionMap : EntityTypeConfiguration<CustomUserPermission>
{
public CustomUserPermissionMap()
{
HasKey(x => x.Id);
HasRequired(x => x.User)
.WithMany()
.Map(x => x.MapKey("UserId"))
.WillCascadeOnDelete(false);
HasRequired(x => x.RolePermissionSetting)
.WithMany()
.Map(x => x.MapKey("RolePermissionId"))
.WillCascadeOnDelete(false);
}
}
To make it work, i had to change my mapping to this:
public class CustomUserPermissionMap : EntityTypeConfiguration<CustomUserPermission>
{
public CustomUserPermissionMap()
{
HasKey(x => x.Id);
HasRequired(x => x.User)
.WithMany()
.HasForeignKey(x => x.UserId)
.WillCascadeOnDelete(false);
HasRequired(x => x.RolePermissionSetting)
.WithMany()
.HasForeignKey(x => x.RolePermissionId)
.WillCascadeOnDelete(false);
}
}
The exception message is this: System.ApplicationException : FK Constriant not found for association 'EFDynamicFilter.EntityFramework.CustomUserPermission_User' - must directly specify foreign keys on model to be able to apply this filter
The second way of mapping entities were working perfectly in EF DynamicFilter 1.4.x. My guess is, that exception occurs when the kind of hierarchy is TPH.
If you need a sample demo, i could send to your e-mail.
Thanks.
Hi,
I'm creating a mvc application from the scratch. I'm using Abp 0.11.0.2 and System.Collections.Immutable 1.2.0.0. After changing that line the Global.asax:
From public class MvcApplication : System.Web.HttpApplication
To public class MvcApplication : AbpWebApplication<MvcAppModule>
The application could not load the System.Collections.Immutable assembly.
Also i tried to use binding redirect like this: <dependentAssembly> <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.1.37.0" newVersion="1.2.0.0" />
</dependentAssembly>
Am I doing something wrong?
Thanks
Hi,
In the new release of AspNetZero (1.10), the test module now must be multi tenant?
Thanks
Hi Halil,
I saw your initial implementation of Aspects in Abp. That implementation is going to be continued? I would like to have a start point to create an aspect to intercept the DbEntityValidationException exceptions and send the errors messages to the SPA. What's is your recommendation for that? Thank you
Hi Halil,
I found out that there is a circular dependency exception, look below:
WARN 2016-04-04 12:41:48,339 [56 ] Default - Exception when resolving optional dependency Dependency 'FeatureValueStore' type 'Abp.Application.Features.IFeatureValueStore' on component Abp.Application.Features.FeatureChecker. Castle.MicroKernel.CircularDependencyException: Dependency cycle has been detected when trying to resolve component 'EZ.EZControl.Authorization.Users.UserManager'. The resolution tree that resulted in the cycle is the following: Component 'EZ.EZControl.Authorization.Users.UserManager' resolved as dependency of component 'EZ.EZControl.MultiTenancy.Demo.TenantDemoDataBuilder' resolved as dependency of component 'EZ.EZControl.MultiTenancy.TenantManager' resolved as dependency of component 'EZ.EZControl.Editions.FeatureValueStore' resolved as dependency of component 'Abp.Application.Features.FeatureChecker' resolved as dependency of component 'Abp.Application.Features.FeatureDependencyContext' resolved as dependency of component 'EZ.EZControl.Authorization.Users.UserManager' resolved as dependency of component 'EZ.EZControl.Authorization.PermissionChecker' resolved as dependency of component 'EZ.EZControl.Web.Controllers.ApplicationController' which is the root component being resolved.
Here is the complete log file:
[https://portalvhdsdtx1sqp9m14cf.blob.core.windows.net/vhds/Logs.txt])
Is this a known issue?
Thanks