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

Activities of "orangeboy"

We have an MVC version of our application in production. Is it possible to leave that version running and start development of new features using the Core version and run both at once?

For example:

mvc.myapp.com core.myapp.com

Ideally once a user logs into one application they are already authenticated and just need to go to the URL of the other. Is this possible for them to share the same authentication cookie and Abp database assuming they are both on the same version number?

That did it! Thank you for your help!

Thanks for replying, ismcagdas.

I didn't change that class from the sample app:

using System.Reflection;
using Abp.EntityFramework;
using Abp.Modules;

namespace AbpEfConsoleApp
{
    //Defining a module depends on AbpEntityFrameworkModule
    [DependsOn(typeof(AbpEntityFrameworkModule))]
    public class MyConsoleAppModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
}

I have been working with a web application that uses Abp Zero, version 1.0.0.0. It is a multi-tenant application in which each tenant has their own database.

I am now attempting to create a console application to add both tenant and host users (I have many to migrate from a previous platform). I started with the sample console app [https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/AbpEfConsoleApp]), upgraded Abp packages to version 1.0.0.0 (and added Abp.Zero packages), and changed the User class to match the one in the web application (which follows the sample framework from [https://github.com/aspnetzero/aspnet-zero/tree/dev/src/MyCompanyName.AbpZeroTemplate.Web])). I also added several classes from my web application (Role, RoleManager, RoleStore, Tenant, UserManager, and UserStore). I changed MyConsoleAppDbContext to inherit from AbpZeroHostDbContext<Tenant, Role, User>.

However, when I run the application, I get an exception at the line "using (var tester = bootstrapper.IocManager.ResolveAsDisposable<Tester>())"

using System;
using Abp;
using Abp.Dependency;
using Castle.Facilities.Logging;

namespace AbpEfConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            //Bootstrapping ABP systems
            using (var bootstrapper = AbpBootstrapper.Create<MyConsoleAppModule>())
            {
                bootstrapper.IocManager
                    .IocContainer
                    .AddFacility<LoggingFacility>(f => f.UseLog4Net().WithConfig("log4net.config"));

                bootstrapper.Initialize();

                //Getting a Tester object from DI and running it
                using (var tester = bootstrapper.IocManager.ResolveAsDisposable<Tester>())
                {
                    tester.Object.Run();
                } //Disposes tester and all it's dependencies

                Console.WriteLine("Press enter to exit...");
                Console.ReadLine();
            }
        }
    }
}

HandlerException:

Can't create component 'AbpEfConsoleApp.UserManager' as it has dependencies to be satisfied. 'AbpEfConsoleApp.UserManager' is waiting for the following dependencies:

  • Service 'AbpEfConsoleApp.RoleManager' which was registered but is also waiting for dependencies. 'AbpEfConsoleApp.RoleManager' is waiting for the following dependencies:
  • Service 'Abp.Zero.Configuration.IRoleManagementConfig' which was not registered.
  • Service 'Abp.Organizations.IOrganizationUnitSettings' which was not registered.
  • Service 'Abp.IdentityFramework.IdentityEmailMessageService' which was not registered.
  • Service 'Abp.Authorization.Users.IUserTokenProviderAccessor' which was not registered."

(Only IRoleManagementConfig is involved in RoleManager, the others are in UserManager, but regardless, they are preventing the program from continuing.)

If I try to register these components individually after bootstrapper.Initialize():

bootstrapper.IocManager.RegisterIfNot<Abp.Zero.Configuration.IRoleManagementConfig>();
bootstrapper.IocManager.RegisterIfNot<Abp.Organizations.IOrganizationUnitSettings>();
bootstrapper.IocManager.RegisterIfNot<Abp.IdentityFramework.IdentityEmailMessageService>();
bootstrapper.IocManager.RegisterIfNot<Abp.Authorization.Users.IUserTokenProviderAccessor>();

I get the ComponentRegistrationException:

Type Abp.Zero.Configuration.IRoleManagementConfig is abstract. As such, it is not possible to instansiate it as implementation of service 'Abp.Zero.Configuration.IRoleManagementConfig'. Did you forget to proxy it?

Classes I think could be relevant to the issue:

public class UserManager : AbpUserManager<Role, User>
    {
        public UserManager(
            UserStore userStore,
            RoleManager roleManager,
            IPermissionManager permissionManager,
            IUnitOfWorkManager unitOfWorkManager,
            ICacheManager cacheManager,
            IRepository<OrganizationUnit, long> organizationUnitRepository,
            IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository,
            IOrganizationUnitSettings organizationUnitSettings,
            ILocalizationManager localizationManager,
            ISettingManager settingManager,
            IdentityEmailMessageService emailService,
            IUserTokenProviderAccessor userTokenProviderAccessor)
            : base(
                  userStore,
                  roleManager,
                  permissionManager,
                  unitOfWorkManager,
                  cacheManager,
                  organizationUnitRepository,
                  userOrganizationUnitRepository,
                  organizationUnitSettings,
                  localizationManager,
                  emailService,
                  settingManager,
                  userTokenProviderAccessor)
        {
        }
    }
public class RoleManager : AbpRoleManager<Role, User>
    {
        public RoleManager(
            RoleStore store,
            IPermissionManager permissionManager,
            IRoleManagementConfig roleManagementConfig,
            ICacheManager cacheManager,
            IUnitOfWorkManager unitOfWorkManager)
            : base(
                store,
                permissionManager,
                roleManagementConfig,
                cacheManager,
                unitOfWorkManager)
        {

        }
public class User : AbpUser<User>
    {
        public virtual Guid? ProfilePictureId { get; set; }

        public virtual bool ShouldChangePasswordOnNextLogin { get; set; }
        public User()
        {
        }
public class Tester : ITransientDependency
    {
        public ILogger Logger { get; set; }
        
        private readonly IRepository<User, long> _userRepository;
        private readonly UserManager _userManager;

        public Tester(IRepository<User, long> userRepository, UserManager userManager)
        {
            _userRepository = userRepository;
            _userManager = userManager;

            Logger = NullLogger.Instance;
        }

        public void Run()
        {
            Logger.Debug("Started Tester.Run()");
            User user = CreateUserObject();
            _userManager.CreateAsync(user, user.Password);

            Logger.Debug("Finished Tester.Run()");
        }

        private User CreateUserObject()
        {
                // ... returns User
        }
    }
using System.Data.Entity;
using Abp.EntityFramework;
using Abp.Zero.EntityFramework;
using Abp.MultiTenancy;

namespace AbpEfConsoleApp
{
    [MultiTenancySide(MultiTenancySides.Host)]
    //EF DbContext class.
    public class MyConsoleAppDbContext : AbpZeroHostDbContext<Tenant, Role, User>
    {
        public MyConsoleAppDbContext()
            : base("Default")
        {

        }

        public MyConsoleAppDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }
    }
}

Why are those particular four services not getting registered? What can I do to fix the problem?

Thanks for any help you can provide!

I would like to hide "/Mpa" in the URL of my application so users can just go to /Dashboard instead of /Mpa/Dashboard. How can I do this?

Question

We need to implement our database model so that all of the Abp tables are in the default database and all of our custom tables are in one database per tenant. We are having an issue where when we specify a connection string for a tenant then it also looks for the AbpUsers and other Abp tables in the tenant's database. We need to keep all of the Abp tables in the default host database. How can we configure the application for this approach?

Showing 1 to 6 of 6 entries