Ends in:
7 DAYS
22 HRS
53 MIN
2 SEC
Ends in:
7 D
22 H
53 M
2 S

Activities of "l.lemmens"

Hello

We're about a month further. Has this been discussed yet? Or could I possibly get an indication when this will be discussed?

Kind regards Lotte

  • ABP Framework version: v4.2.2
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

We have an object named 'trading company', this object contains a list of 'trading company dynamic fields'

public class TradingCompany : FullAuditedEntity<Guid>
    {
       ///other props

        /// <summary>
        /// DynamicFields.
        /// </summary>
        public IEnumerable<TradingCompanyDynamicField> Dynamicfields { get; set; }
    }

 public class TradingCompanyDynamicField: Entity<Guid>
    {
        /// <summary>
        /// DynamicField.
        /// </summary>
        public string DynamicField { get; set; }
    }

In the trading company appservice we have to update all the dynamic fields manually

public virtual async Task<TradingCompanyDto> UpdateAsync(Guid id, TradingCompanyUpdateDto input)
        {
            var tradingCompany = _tradingCompanyRepository.AsQueryable()
                .Where(d => d.Id == id)
                .Include(d => d.Dynamicfields)
                .FirstOrDefault();

            var currentList = tradingCompany.Dynamicfields;

            ObjectMapper.Map(input, tradingCompany);
            tradingCompany = await _tradingCompanyRepository.UpdateAsync(tradingCompany);

            // Delete in current not in input.
            var toDelete = currentList.Where(c => currentList.Select(d => d.Id).ToList().IndexOf(c.Id) == -1);
            await _tradingCompanyDynamicFieldRepository.DeleteManyAsync(toDelete);

            // Add in input, not in current.
            var toAdd = currentList.Where(c => currentList.Select(d => d.Id).ToList().IndexOf(c.Id) == -1);
            await _tradingCompanyDynamicFieldRepository.InsertManyAsync(
               toAdd.Select(a => new TradingCompanyDynamicField
               {
                   DynamicField = a.DynamicField,
                   TradingCompanyId = tradingCompany.Id
               }));

            // Update others.
            var toUpdate = currentList.Where(c => currentList.Select(d => d.Id).ToList().IndexOf(c.Id) > -1);
            await _tradingCompanyDynamicFieldRepository.UpdateManyAsync(
               toUpdate.Select(u => ObjectMapper.Map(currentList.FirstOrDefault(i => i.Id == u.Id), u))
               );

            return ObjectMapper.Map<TradingCompany, TradingCompanyDto>(tradingCompany);
        }

What we want would be something like this, this would also update all dynamicfields automatically:

public virtual async Task<TradingCompanyDto> UpdateAsync(Guid id, TradingCompanyUpdateDto input)
        {
            var tradingCompany = _tradingCompanyRepository.AsQueryable()
                .Where(d => d.Id == id)
                .Include(d => d.Dynamicfields)
                .FirstOrDefault();

            ObjectMapper.Map(input, tradingCompany);
            tradingCompany = await _tradingCompanyRepository.UpdateAsync(tradingCompany);

            return ObjectMapper.Map<TradingCompany, TradingCompanyDto>(tradingCompany);
        }

Executing the desired code results in swagger to the expected data. For example, update a trading company having 3 dynamic fields to one having only 2, returns an object only containing the 2 dynamic fields. But when we get by id/list or check in the database, we'll see all dynamic fields have the property 'isdeleted' set to true.

How can we achieve this?

Kind regards Lotte

That got me there, thanks :)

public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            PreConfigure<IMvcBuilder>(mvcBuilder =>
            {
                mvcBuilder.Services.AddControllersWithViews()
                .AddMvcOptions(o =>
                {
                    o.Conventions.Add(new SwaggerFilePickerConvention());
                });
            });
        }

I have seen this and I would like a possibility to add this to a non MVC project

// Startup.cs
public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc(c =>
        c.Conventions.Add(new ApiExplorerGroupPerVersionConvention())
    );

    ...
}

I'm using abpio and it generates this of MVC-options:

Configure<AbpAspNetCoreMvcOptions>(options =>
            {
                options.ConventionalControllers.Create(typeof(DLV_TC_PlatformApplicationModule).Assembly);
            });

And I cannot find any convention settings there.

Kind regards Lotte

  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

We'd like to have different swagger files for sections of our code. I've added following items in the hostmodule to add a second swagger definition:

options.SwaggerDoc("v1-backoffice", new OpenApiInfo { Title = "DLV_TC_Platform API Backoffice", Version = "v1" });
options.SwaggerDoc("v1-frontend", new OpenApiInfo { Title = "DLV_TC_Platform API Frontend", Version = "v1" });

options.SwaggerEndpoint("/swagger/v1-backoffice/swagger.json", "DLV_TC_Platform API BackOffice");
options.SwaggerEndpoint("/swagger/v1-frontend/swagger.json", "DLV_TC_Platform API Frontend");

With this setup you get two versions but they are the same.

How can I now indicate which services may appear on which swagger? Preferably with a convention-like method, so it can be setup once and then 'forgotten'.

Kind regards Lotte

Answer

Hello

I had a working solution, then I've added the AccountModule and ThemeModule as a project to my solution (cfr. Link), but now the tests are broken. EFCoreTests are still fine.

Application tests fail with following message: Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule, Volo.Abp.AspNetCore.Mvc, Version=4.2.1.0, Culture=neutral, PublicKeyToken=null: Could not find singleton service: Microsoft.AspNetCore.Hosting.IWebHostEnvironment, Microsoft.AspNetCore.Hosting.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60. See the inner exception for details. ---- System.InvalidOperationException : Could not find singleton service: Microsoft.AspNetCore.Hosting.IWebHostEnvironment, Microsoft.AspNetCore.Hosting.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

Stacktrace: ModuleManager.InitializeModules(ApplicationInitializationContext context) AbpApplicationBase.InitializeModules() AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider) AbpIntegratedTest1.ctor() InduwareIOTestBase1.ctor() InduwareIOApplicationTestBase.ctor() CollectiveLeaveAppServiceTests.ctor() line 18 ----- Inner Stack Trace ----- ServiceCollectionCommonExtensions.GetSingletonInstance[T](IServiceCollection services) AbpAspNetCoreServiceCollectionExtensions.GetHostingEnvironment(IServiceCollection services) <>c__DisplayClass1_0.<ConfigureServices>b__2(AbpAspNetCoreMvcOptions options) PostConfigureOptions1.PostConfigure(String name, TOptions options) OptionsFactory1.Create(String name) <>c__DisplayClass5_0.<Get>b__0() Lazy1.ViaFactory(LazyThreadSafetyMode mode) Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) Lazy1.CreateValue() Lazy1.get_Value() OptionsCache1.GetOrAdd(String name, Func1 createOptions) OptionsManager1.Get(String name) OptionsManager1.get_Value() AbpAspNetCoreMvcModule.AddApplicationParts(ApplicationInitializationContext context) AbpAspNetCoreMvcModule.OnApplicationInitialization(ApplicationInitializationContext context) OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module) ModuleManager.InitializeModules(ApplicationInitializationContext context)

The module AbpAspnetCoreMvcModule is only used in the seperate AccountModule and ThemeModule. What do I do to fix this?

Answer

Spelling mistake in the template:

Answer

entity: { "Id": "0c368538-43bf-4bc3-81b8-9ea81fc7d7d5", "Name": "DynamicFieldGroup", "OriginalName": "DynamicFieldGroup", "NamePlural": "DynamicFieldGroups", "DatabaseTableName": "DynamicFieldGroups", "Namespace": "DynamicFieldGroups", "BaseClass": "FullAuditedAggregateRoot", "PrimaryKeyType": "Guid", "IsMultiTenant": true, "ShouldCreateUserInterface": false, "ShouldCreateBackend": false, "ShouldAddMigration": true, "ShouldUpdateDatabase": true, "CreateTests": true, "Properties": [ { "Id": "e7f10311-d742-47d5-b767-57082c28d9a0", "Name": "Name", "Type": "string", "EnumType": "", "EnumNamespace": "", "EnumAngularImport": "shared/enums", "IsNullable": false, "IsRequired": true, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0, "Regex": "", "EmailValidation": false, "EnumValues": null }, { "Id": "e5020837-cd7f-40c6-8e01-ee66bdde73f9", "Name": "Order", "Type": "int", "EnumType": "", "EnumNamespace": "", "EnumAngularImport": "shared/enums", "IsNullable": false, "IsRequired": true, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0, "Regex": "", "EmailValidation": false, "EnumValues": null }, { "Id": "01727782-35c5-4b65-a587-d81314d92d06", "Name": "Type", "Type": "enum", "EnumType": "will define the discriminator for a dynamic field.\r\n /// </summary>\r\n public enum DynamicFieldEntityType", "EnumNamespace": "InduwareIO.Shared", "EnumAngularImport": "shared/enums/will-define-the-discriminator-for-a-dynamic-field-summary-public-enum-dynamic-field-entity-type", "IsNullable": false, "IsRequired": true, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0, "Regex": "", "EmailValidation": false, "EnumValues": { "Product": 0, "Supplier": 1, "Project": 2, "Employee": 3 } } ], "NavigationProperties": [], "PhysicalFileName": "DynamicFieldGroup.json" } enum: namespace InduwareIO.Shared { public enum DynamicFieldEntityType { Product = 0, Supplier = 1, Project = 2, Employee = 3 } }

Answer

Hello

All automatic generated classes and repositories seem invalid. A piece of the summary seems to be included every time it should just need 'DynamicFieldEntityType type'

  • DynamicFieldGroupDto
  • DynamicFieldGroupCreateDto
  • DynamicFieldGroupUpdateDto
  • GetDynamicFieldGroupInput
  • DynamicFieldGroup
  • EfCoreDynamicFieldGroupRepository
  • IDynamicFieldGroupRepository
Answer

Hello

Adding a property with an enum value is unable to save and generate:

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