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

Activities of "bulutyonetim"

Hi,

That was what I need thanks for helpping.

Hi

The post you referred did not helped me to solve this completely. I tried to get environment from command line in Pudux.Migrator.Main() like this:

public static void Main(string[] args)
{
    ParseArgs(args);
    //.............
 }
 
private static void ParseArgs(string[] args)
{
    if (args.IsNullOrEmpty())
    {
        return;
    }

    foreach (var arg in args)
    {
        if (arg == "-s")
        {
            _skipConnVerification = true;
        }

        if (arg.ToLower() == "-staging")
        {
            _env = "Staging";
        }

        if (arg.ToLower() == "-production")
        {
            _env = "Production";
        }
    }
}

But could not fine a way to pass _env to xxxMigratorModule constructure where asp.net zero is getting configuration settings. If I could pass it I can get desired configuration like this:

_appConfiguration = AppConfigurations.Get(
    typeof(PuduxMigratorModule).GetAssembly().GetDirectoryPathOrNull(),
    environmentName,
    addUserSecrets: true
);

Hi,

Thanks.

Hi,

Thanks for answer. What is best practice of overriding CreateAsync method of UserManager. I do not want my code be lost when I update my project to lateset Asp.net Zero in future.

Hi, Thanks.

Hi,

I tried to get what I needed with the help of domain events. But I have a problem.

Suppose this: When I create a User1 in tenant A, my domain activity is triggered. In the case of domain, I add the new user with the same attributes to the Default tenant. however, this action triggers my domain activities again.

I am having the same problem updating user information. For example, when I change the user's last name in Tenant A, my domain activity is triggered, so I update the user's last name in Tenant Default, but again this update repeats the triggers domain event.

Any solution to turn off the domain event in a section of the code? Or is there any way to get any information that shows me that the event was routed by the system and not the end user?

Here is my code for recreate user in default tenant:

 public virtual void HandleEvent(EntityCreatingEventData<AbpUserBase> eventData)
        {
            //If user is not being added to host or default tenant
            if (eventData.Entity.TenantId != null && eventData.Entity.TenantId != 1)
            {
                //Workining on default tenant
                using (_unitOfWorkManager.Current.SetTenantId(1))
                {
                    //Get all users of default tenant
                    IQueryable<User> allUser = _userRepository.GetAll();

                    //Get user with same email or username
                    var defaultTenantUser = allUser.FirstOrDefault(ua => ua.TenantId == 1 && (ua.UserName == eventData.Entity.UserName || ua.EmailAddress == eventData.Entity.EmailAddress));

                    //If user with same email or username is not available in default tenant
                    if (defaultTenantUser == null)
                    {
                        //add "User" Role to new user roles
                        var userRoles = new Collection<UserRole>();
                        var defaultRole = _roleRepository.FirstOrDefault(r => r.Name == Pudux.Authorization.Roles.StaticRoleNames.Tenants.User);
                        userRoles.Add(new UserRole(1, eventData.Entity.Id, defaultRole.Id));

                        var userToAdd = new User
                        {
                            TenantId = 1,
                            UserName = eventData.Entity.UserName,
                            Name = eventData.Entity.Name,
                            Surname = eventData.Entity.Surname,
                            EmailAddress = eventData.Entity.EmailAddress,
                            Password = eventData.Entity.Password,
                            PasswordResetCode = eventData.Entity.PasswordResetCode,
                            EmailConfirmationCode = eventData.Entity.EmailConfirmationCode,
                            IsActive = eventData.Entity.IsActive,
                            IsDeleted = eventData.Entity.IsDeleted,
                            IsEmailConfirmed = eventData.Entity.IsEmailConfirmed,
                            IsLockoutEnabled = eventData.Entity.IsLockoutEnabled,
                            IsPhoneNumberConfirmed = eventData.Entity.IsPhoneNumberConfirmed,
                            IsTwoFactorEnabled = eventData.Entity.IsTwoFactorEnabled,
                            NormalizedEmailAddress = eventData.Entity.EmailAddress.ToUpperInvariant(),
                            NormalizedUserName = eventData.Entity.UserName.ToUpperInvariant(),
                            Roles = userRoles,
                        };

                        //add user to default tenants
                        _userRepository.Insert(userToAdd);
                    }
                }
            }
        }

tnx

Hi,

Thanks for solution, Domain events are great feature.

Hi same Problem here:

D:\XXX\Git\Projects\XXX\XXXDemo\src\XXXDemo.Web.Host\XXXDemo.Web.Host.csproj : error : Cannot expand metadata in expression "$([MSBuild]::ValueOrDefault('%(FullPath)', '').StartsWith($([MSBuild]::EnsureTrailingSlash($(MSBuildProjectDirectory)))))". The item metadata "%(FullPath)" cannot be applied to the path "src\app\admin\dynamic-entity-parameters\entity-dynamic-parameter\entity-dynamic-parameter-value\entity-dynamic-parameter-value-manager\entity-dynamic-parameter-value-manager.component.html". Path: D:\XXX\Git\Projects\XXX\XXXDemo\src\XXXDemo.Web.Host\src\app\admin\dynamic-entity-parameters\entity-dynamic-parameter\entity-dynamic-parameter-value\entity-dynamic-parameter-value-manager\entity-dynamic-parameter-value-manager.component.html

exceeds the OS max path limit. The fully qualified file name must be less than 260 characters

. C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets

We had to decrease folders name or move project to uper floders but it would disrupt our folder structure.

What you (support team) recomend for this case?

Showing 11 to 19 of 19 entries