Base solution for your next web application

Activities of "marcosli"

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.

Question

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.

In my case i'm using the ASP.NET MVC 5.x & Angularjs 1.x template, so i guess it will be different to debug and add references to the abp assemblies

Question

Is there any way to debug the abp 1.x.x.x ? I tried to do the following:

  1. Remove the assemblies that were added to a project using nuget
  2. Add the abp.xproj's to the solution
  3. Add the abp.xproj's references to my test application project.
  4. and tried to built it.

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,

I've sent an email to <a href="mailto:[email protected]">[email protected]</a> with the link to the application.

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.

Halil,

Did you take a look at this issue?

Thanks

Hi Halil,

I've sent the e-mail... Did you received?

Thanks

Showing 1 to 10 of 43 entries