Activities of "zhongfang"

Oh...

ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService<ITenantRepository>();

tenantRepository is null

2022-11-17 11:10:23.791 +08:00 [INF] Starting: 【扫码关注】积分发放... 2022-11-17 11:10:46.619 +08:00 [ERR] Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Yee.Change.AdminBlazorUI.WorkItems.FansJoinedNotifierWorkItem.FansSubscribedPoint() in D:\dev\abp\change\admin-blazor-ui\src\Yee.Change.AdminBlazorUI.Application\WorkItems\FansJoinedNotifierWorkItem.cs:line 97 at Yee.Change.AdminBlazorUI.WorkItems.FansJoinedNotifierWorkItem.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) in D:\dev\abp\change\admin-blazor-ui\src\Yee.Change.AdminBlazorUI.Application\WorkItems\FansJoinedNotifierWorkItem.cs:line 56 at Volo.Abp.BackgroundWorkers.AsyncPeriodicBackgroundWorkerBase.DoWorkAsync(CancellationToken cancellationToken) 2022-11-17 11:10:51.016 +08:00 [INF] Initialized all ABP modules.

and I try another way,

            ICurrentTenant currentTenant = this.LazyServiceProvider.LazyGetRequiredService&lt;ICurrentTenant&gt;();
            ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService&lt;ITenantRepository&gt;();

            if (allTenants == null)
            {
                using (currentTenant.Change(null))
                {
                    allTenants = await tenantRepository.GetListAsync();
                }
            }

got the same error again: Object reference not set to an instance of an object.

public class FansJoinedNotifierWorkItem : AsyncPeriodicBackgroundWorkerBase
{
    public FansJoinedNotifierWorkItem(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory) : base(timer, serviceScopeFactory)
    {
        this.Timer.Period = 60 * 1000;
    }

    protected async override Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
    {
        this.Timer.Period = 1440 * 60 * 1000;

        扫码关注送积分 subscribPoint = new 扫码关注送积分();
        subscribPoint.LazyServiceProvider = this.LazyServiceProvider;
        await this.FansSubscribedPoint();
        
        this.Timer.Period = siteOptions.Value.UserFollowNotifyIntervalMinutes * 60 * 1000;
    }

    static List<Tenant> allTenants;
    public async Task FansSubscribedPoint()
    {
        Log.Information("Starting: 【扫码关注】积分发放...");
        
        IDataFilter dataFilter = this.LazyServiceProvider.LazyGetRequiredService<IDataFilter>();

        if (allTenants == null)
        {
            using (dataFilter.Disable<IMultiTenant>())
            {
                ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService<ITenantRepository>();

                allTenants = await tenantRepository.GetListAsync();
            }
        }

        ……

        Log.Information("Completed: 【扫码关注】积分发放...");
    }
}
  • ABP Framework version: v6.0.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: System.NullReferenceException:“Object reference not set to an instance of an object.”
  • Steps to reproduce the issue:" 1)method in background worker 2)ITenantRepository tenantRepository = this.LazyServiceProvider.LazyGetRequiredService<ITenantRepository>(); 3)List<Tenant> allTenants = await tenantRepository.GetListAsync();

Volo.Abp.Identity.Pro.Domain need standard 2.1?

So I must change all of my projects with Domain from NET Standard 2.0 to NET Standard 2.1.

/builds/change/account/src/Yee.Change.Account.Domain.Shared/Yee.Change.Account.Domain.Shared.csproj : error NU1103: Unable to find a stable package Volo.Abp.Identity.Pro.Domain.Shared with version (>= 5.3.0)

The newest stable version of above package is 5.0.2?

Answer

var query = dbContext.Where(p => p.ItemKey == input.ItemKey && p.ItemType == input.ItemType).DistinctBy(p => p.EventTypeId);

I can not change the color of the text.

Question
  • ABP Framework version: v5.2.2
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
[09:15:02 WRN] Unhandled exception rendering component: The LINQ expression 'DbSet&lt;EventDesc&gt;()
    .Where(p => (Guid?)p.ItemKey == __input_ItemKey_0 && p.ItemType == __input_ItemType_1)
    .DistinctBy(p => p.EventTypeId)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
System.InvalidOperationException: The LINQ expression 'DbSet&lt;EventDesc&gt;()
    .Where(p => (Guid?)p.ItemKey == __input_ItemKey_0 && p.ItemType == __input_ItemType_1)
    .DistinctBy(p => p.EventTypeId)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
   at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.Expand(Expression query)
   at Microsoft.EntityFrameworkCore.Query.QueryTranslationPreprocessor.Process(Expression query)
   at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.&lt;&gt;c__DisplayClass9_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
   at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
   at Yee.Change.EventRecorder.EventDescs.EventDescAppMoreService.GetAllEventsListAsync(GetEventDescsInput input) in D:\abp-change\event-recorder\src\Yee.Change.EventRecorder.Application\EventDescs\EventDescAppMoreService.cs:line 38
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
   at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Yee.Change.EventRecorder.Blazor.Shared.MyCaseWorksListView.OnInitializedAsync() in D:\abp-change\event-recorder\src\Yee.Change.EventRecorder.Blazor\Shared\MyCaseWorksListView.razor:line 28
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
  • Steps to reproduce the issue:"
 [Authorize(EventRecorderPermissions.EventDescs.Default)]
    public class EventDescAppMoreService : ApplicationService, IEventDescAppMoreService
    {
        private readonly IEventDescRepository _eventDescRepository;
        private readonly EventDescManager _eventDescManager;
        private readonly IRepository&lt;ReplyRole, Guid&gt; _replyRoleRepository;

        public EventDescAppMoreService(IEventDescRepository eventDescRepository, EventDescManager eventDescManager, IRepository&lt;ReplyRole, Guid&gt; replyRoleRepository)
        {
            _eventDescRepository = eventDescRepository;
            _eventDescManager = eventDescManager; _replyRoleRepository = replyRoleRepository;
        }

        public virtual async Task&lt;PagedResultDto&lt;EventDescDto&gt;> GetAllEventsListAsync(GetEventDescsInput input)
        {
            var dbContext = await this._eventDescRepository.GetQueryableAsync();


            var query = dbContext.Where(p => p.ItemKey == input.ItemKey && p.ItemType == input.ItemType).**DistinctBy(p => p.EventTypeId);**

            int totalCount = query.Count();


            return new PagedResultDto&lt;EventDescDto&gt;
            {
                TotalCount = totalCount,
                Items = ObjectMapper.Map&lt;List&lt;EventDesc&gt;, List&lt;EventDescDto&gt;>(query.Skip(input.SkipCount).Take(input.MaxResultCount).ToList())
            };
        }
    }

tks a lot!

Showing 71 to 80 of 160 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30