Hi again.
For earlier version such as yours, you can add following class into your Domain project and replace & override the QuestionManager with the fixed code block.
I personally don't recommend to set protected or private properties via using reflection but in that case, it can be patched like this.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
using Volo.Forms;
using Volo.Forms.Forms;
using Volo.Forms.Questions;
using Volo.Forms.Questions.ChoosableItems;
namespace YourProjectName;
[ExposeServices(typeof(QuestionManager))]
[Dependency(ReplaceServices = true)]
public class MyQuestionManager : QuestionManager
{
protected IQuestionRepository questionRepository;
public MyQuestionManager(
IQuestionRepository questionRepository,
IFormRepository formRepository,
IGuidGenerator guidGenerator) : base(questionRepository, formRepository, guidGenerator)
{
this.questionRepository = questionRepository;
}
public override async Task<QuestionBase> UpdateAsync(Guid id, string title, int index, bool isRequired, string description, QuestionTypes questionType, bool hasOtherOption, List<(Guid Id, string value, bool isCorrect)> choiceList)
{
var question = await questionRepository.GetAsync(id);
var questionId = question.Id;
var formId = question.FormId;
var creationDate = question.CreationTime;
// This will be removed when EfCore bug is resolved: https://github.com/dotnet/efcore/issues/22016
// Since item with choice collection can't return single object; we can't remove choices over item.
await ClearItemChoicesAsync(question);
question = await questionRepository.GetAsync(id);
await questionRepository.HardDeleteAsync(question, autoSave: true);
var createdQuestion = CreateItemBasedOnType(questionType, questionId);
createdQuestion
.SetFormId(formId)
.SetTitle(title)
.SetIndex(index)
.SetDescription(description);
createdQuestion.SetRequired(isRequired);
createdQuestion.SetOtherOption(hasOtherOption);
if (createdQuestion is IChoosable choosableItem)
{
if (!(question is IChoosable))
{
for (var i = 0; i < choiceList.Count; i++)
{
choosableItem.AddChoice(id: GuidGenerator.Create(), index: i + 1, value: choiceList[i].value, isCorrect: choiceList[i].isCorrect);
}
}
else
{
UpdateIndexesOfChoiceList(choiceList);
choosableItem.AddChoices(choiceList);
}
}
createdQuestion.CreationTime = creationDate;
createdQuestion.LastModificationTime = DateTime.Now;
FixChoicesTenants(createdQuestion);
await UpdateFormLastModificationDateAsync(createdQuestion.FormId);
return await questionRepository.InsertAsync(createdQuestion, true);
}
private void FixChoicesTenants(QuestionBase createdQuestion)
{
if(createdQuestion is Checkbox checkbox)
{
foreach(var choice in checkbox.Choices)
{
SetProperty(choice, nameof(IMultiTenant.TenantId), CurrentTenant.Id);
}
}
if (createdQuestion is ChoiceMultiple choiceMultiple)
{
foreach(var choice in choiceMultiple.Choices)
{
SetProperty(choice, nameof(IMultiTenant.TenantId), CurrentTenant.Id);
}
}
if (createdQuestion is DropdownList dropdownList)
{
foreach(var choice in dropdownList.Choices)
{
SetProperty(choice, nameof(IMultiTenant.TenantId), CurrentTenant.Id);
}
}
}
private void SetProperty<T>(T obj, string propertyName, object value)
{
typeof(T).GetProperty(propertyName)?.SetValue(obj, value);
}
}
In the v5.2.2
, you can use -u
parameter but somehow -u
became a required parameter. We'll fix this in 5.2.3
.
But short answer is yes you can use URL parameter in 5.2.2
This problem has been already solved in v5.2.2
.
Since It's an entity related problem and can't override or replace entity class. So I can't suggest to you a workaround now, you can update to 5.2.2
Also your credit is refunded
We have validated the problem. We'll be working on the next patch version. I'll share with you a workaround as soon as possible.
Hi @sukhdeep.dhillon
You can access it via installing Volo.CmsKit.Pro.Public.*
nuget packages to your project.
In that case, you have a single application, So you should install the following packages:
Volo.CmsKit.Pro.Public.Application
to your Cao.AbpPoc.Application
Volo.CmsKit.Pro.Public.Application.Contracts
to your Cao.AbpPoc.Application.Contracts
Volo.CmsKit.Pro.Public.Domain
to your Cao.AbpPoc.Domain
Volo.CmsKit.Pro.Public.Domain.Shared
to your Cao.AbpPoc.Domain.Shared
Volo.CmsKit.Pro.Public.EntityFrameworkCore
to your Cao.AbpPoc.EntityFrameworkCore
Volo.CmsKit.Pro.Public.HttpApi
to your Cao.AbpPoc.HttpApi
Volo.CmsKit.Pro.Public.HttpApi.Client
to your Cao.AbpPoc.HttpApi.Client
Volo.CmsKit.Pro.Public.Web
to your Cao.AbpPoc.Web
And don't forget to add [DependsOn] attributes for each project.
Also, instead of installing both Admin and Public packages, you can convert Admin package references to unified one.
In example, Convert Volo.CmsKit.Pro.Admin.Application
to Volo.CmsKit.Pro.Application
and
Convert [DependsOn(typeof(CmsKitProAdminApplicationModule )]
to [DependsOn(typeof(CmsKitProApplicationModule )]
Make sure each layer has been converted.
I've tried with v5.2.1
as you said but couldn't reproduce that exception. Can you please share the steps to reproduce?
Can you check /api/abp/api-definition
URL and make sure your module name is included in the JSON from response. Maybe your module name is configured differently than productService
.
By the way, if you're using CLI version 5.2, -u
parameter won't work. In that version it still uses environment to define URL to get api-configuration.
You can try again after updating your CLI to 5.3.0-rc.1
dotnet tool update -g Volo.Abp.Cli --version 5.3.0-rc.1
Also Upgrage your @abp/ng.schematics package version to 5.3.0-rc.1
//package.json
"@abp/ng.schematics": "5.3.0-rc.1"
Can you provide the json body of that request?
This error shows there is a parsing error.
Blazor server results in this:
[2022-05-10T02:48:13.945Z] Information: Normalizing '_blazor' to 'https://localhost:44313/_blazor'. blazor.server.js?_v=637835526540000000:1 [2022-05-10T02:48:14.026Z] Information: WebSocket connected to wss://localhost:44313/_blazor?id=aPjN5Xo_PibYnFkOs7-Ukw. blazor.server.js?_v=637835526540000000:1 [2022-05-10T02:48:14.939Z] Error: System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components.ApplicationLayout.SideMenu.Navigation.MobileNavbar.BuildRenderTree(RenderTreeBuilder __builder) at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder) at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException) log @ blazor.server.js?_v=637835526540000000:1 blazor.server.js?_v=637835526540000000:1 [2022-05-10T02:48:14.940Z] Information: Connection disconnected. blazor.server.js?_v=637835526540000000:1 Uncaught (in promise) Error: Invocation canceled due to the underlying connection being closed. at kt._connectionClosed (blazor.server.js?_v=637835526540000000:1:72787) at bt.connection.onclose (blazor.server.js?_v=637835526540000000:1:64488) at bt._stopConnection (blazor.server.js?_v=637835526540000000:1:59982) at vt.transport.onclose (blazor.server.js?_v=637835526540000000:1:57720) at vt._close (blazor.server.js?_v=637835526540000000:1:49954) at vt.stop (blazor.server.js?_v=637835526540000000:1:49574) at bt._stopInternal (blazor.server.js?_v=637835526540000000:1:52869) at async bt.stop (blazor.server.js?_v=637835526540000000:1:52679) at async kt.stop (blazor.server.js?_v=637835526540000000:1:67060) DevTools failed to load source map: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/scripts/content_scroll_mid_detection.map: System error: net::ERR_BLOCKED_BY_CLIENT DevTools failed to load source map: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/scripts/iframe_form_check.map: System error: net::ERR_BLOCKED_BY_CLIENT
Can you share steps to reproduce this issue?
We can't reproduce this issue with freshly created a new project.
Hi
I reproduced the problem. It seems the problem occurs because of null browserinfo data. We'll fix that problem and release in a patch version but you can use following workaround for now.
CreateMap<IdentitySecurityLog, IdentitySecurityLogDto>()
.ForMember(p => p.BrowserInfo, dest => dest.MapFrom(r => r.BrowserInfo ?? string.Empty));