Ends in:
7 DAYS
13 HRS
37 MIN
57 SEC
Ends in:
7 D
13 H
37 M
57 S

Activities of "SuperBeastX3"

See if this link works for you: https://1drv.ms/u/s----------------?e=FhNSL1

A zipped sample is 242Mb, I can't email that. Do you have a place I can copy it to?

ABP Framework version: v7.3.3 UI Type: MVC Database System: EF Core Tiered (for MVC) or Auth Server Separated (for Angular): tiered

I am trying to dataseed an object with a many to many collection. I create the collection items first, and then try to use those ids on insert of the many to many, but it never actually saves them. The underlying checks SetAssetCategoriesAsync don't see them yet because they are not in the database, so it doesn't pull any to save.

assetCategoryList.Add(await _assetCategoryManager.CreateAsync("Corporate Laptop", "Corporate Laptop", true));
assetCategoryList.Add(await _assetCategoryManager.CreateAsync("Developer Laptop", "Developer Laptop", true));

This next line creates the my asset taxonomy item, but doesn't add the newly created asset categories.

assetTaxonomy = await _assetTaxonomyManager.CreateAsync(assetCategoryList.Select(e => e.Id).ToList(), "Asset Taxonomy", "Asset Taxonomy Description"); ;

In the SetAssetCategoriesAsync (created by abp suite), no categories are found:

var query = (await _assetCategoryRepository.GetQueryableAsync())
    .Where(x => assetCategoryIds.Contains(x.Id))
    .Select(x => x.Id);
var assetCategoryIdsInDb = await AsyncExecuter.ToListAsync(query);
if (!assetCategoryIdsInDb.Any())
{
    return;
}

Please advise, thanks!

I took a different approach and modified the MigrateAndSeedForTenantAsync method. Using: var version = await _featureManager.GetOrNullForTenantAsync("Version", tenantId); seems to have the correct value, so I added a property: ` // Seed data using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) { await _dataSeeder.SeedAsync( new DataSeedContext(tenantId) .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, adminEmail) .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, adminPassword) .WithProperty("Version", version) );

 await uow.CompleteAsync();

} `

Maybe part of the problem is the tenant record doesnt exist in the database yet when the dataseeder runs?

Same result, just returns the default value of the feature.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Features;
using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Security.Claims;
using Volo.Saas.Tenants;

namespace MyCore.DataSeedContributors
{
    public class AddAbpRoleDataSeedContributor : IDataSeedContributor, ITransientDependency
    {
        private readonly IdentityUserManager _identityUserManager;
        private readonly IdentityRoleManager _identityRoleManager;
        private readonly IPermissionDataSeeder _permissionDataSeeder;
        private readonly IFeatureChecker _featureChecker;
        private readonly IPermissionDefinitionManager _permissionDefinitionManager;


        public AddAbpRoleDataSeedContributor(IdentityUserManager identityUserManager, IdentityRoleManager identityRoleManager, IPermissionDataSeeder permissionDataSeeder, IFeatureChecker featureChecker, IPermissionDefinitionManager permissionDefinitionManager)
        {
            _identityUserManager = identityUserManager;
            _identityRoleManager = identityRoleManager;
            _permissionDataSeeder = permissionDataSeeder;
            _featureChecker = featureChecker;
            _permissionDefinitionManager = permissionDefinitionManager;
        }

        public async Task SeedAsync(DataSeedContext context)
        {
            var version = await _featureChecker.GetOrNullAsync("Version");
            
            if(version == "V2") 
            {
                //dosomething for V2 

            }
            else
            {
                //dosomthing for V1
            }
        }
    }
}

In addition to this, I really want to know what Edition the tenant I just created is using, but I can't seem to find a way to it.

Im not sure I understand what you are asking. The tenant id that gets passed into the data seeding is the correct Id, and all the seeded items have the correct tenant id. I do not use currenttenant in the data seeding.

Can you be more specific as to what you are asking?

First, I created a new feature using this:

var myGroup = context.AddGroup("Version");


myGroup.AddFeature(
    "Version",
    defaultValue: "V1",
    displayName: LocalizableString
    .Create<MaestroCoreResource>("My.Version"),
    valueType: new SelectionStringValueType
    {
        ItemSource = new StaticSelectionStringValueItemSource(
           new LocalizableSelectionStringValueItem
           {
               Value = "V1",
               DisplayText = new LocalizableStringInfo("MyResource", "My.Version.V1")
           },
           new LocalizableSelectionStringValueItem
           {
               Value = "V2",
               DisplayText = new LocalizableStringInfo("MyResource", "My.Version.V2")
           }),
        Validator = new AlwaysValidValueValidator()
    }
);

Then, when I create a Tenant, I am choosing "V2" for my Version feature.

When it seeds the data, I want to do specific seeding based on that version:

var version = await _featureChecker.GetOrNullAsync("Version");

if(version == "V2") 
{
    //do something for V2

}
else
{
    //do something for V1
}

I would expect the code of: await _featureChecker.GetOrNullAsync("Version"); Would return the correct version, but no matter what it always returns the default value set in the feature.

  • ABP Framework version: v7.3.3
  • UI Type: MVC
  • Database System: EF Core
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

When I seed data for a new tenant, how can I get the edition? I tried using a feature of the edition with the feature checker, but that value is only set to the default value and isn't pulling in the correct editions feature. What is the proper way when data seeding to do this?

In my data seeder I am doing this: var featureName = await _featureChecker.GetOrNullAsync("FeatureName");

But it is always just the default value.

Thanks!

Showing 11 to 20 of 30 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06