"murat.yuceer" 'in aktiviteleri

Cevap

ABP Framework version: v4.4.2 UI type: Blazor Server DB provider: EF Core

When you create from module template, its not add lines below for Blazor.Server.Host module

            Configure<AbpMultiTenancyOptions>(options =>
            {
                options.IsEnabled = MultiTenancyConsts.IsEnabled;
            });
Cevap

I using ILookupApiRequestService to call abp api without dynamicsystem (i have some reasons).

I using module template to start project with Blazor.Server.Host (unified)

But line 58 not throw error, because of that its not add headers or cookie to authenticate

https://github.com/abpframework/abp/blob/6253849bc59c0158e77237bb3652ae0585fe110e/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Extensibility/BlazorServerLookupApiRequestService.cs

override devex api controllers

using System.Threading.Tasks;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer.Native.Services;
using Kuys.Shared.AspNetCore.DevExp.Reporting.HttpApi.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Kuys.Shared.AspNetCore.DevExp.Reporting.HttpApi.Controllers
{
    [ApiExplorerSettings(IgnoreApi = true)]
    [Route("DXXRDV")]
    public class CustomWebDocumentViewerController : WebDocumentViewerController
    {
        private readonly IExportResultProvider _exportResultProvider;

        public CustomWebDocumentViewerController(
            IWebDocumentViewerMvcControllerService controllerService, 
            IExportResultProvider exportResultProvider) : 
            base(controllerService)
        {
            _exportResultProvider = exportResultProvider;
        }

        [Authorize]
        [Route("Invoke")]
        public override Task<IActionResult> Invoke()
        {
            return base.Invoke();
        }

        [HttpPost]
        [Route("GetExportResult")]
        public ActionResult GetExportResult(string token)
        {
            ExportResult exportResult;
            if (!_exportResultProvider.TryGetExportResult(token, out exportResult))
            {
                return StatusCode(StatusCodes.Status404NotFound, "Exported document was not found. Try to export the document once again.");
            }
            var fileResult = File(exportResult.GetBytes(), exportResult.ContentType);
            if (exportResult.ContentDisposition != System.Net.Mime.DispositionTypeNames.Inline)
            {
                fileResult.FileDownloadName = exportResult.FileName;
            }

            return fileResult;
        }
    }
}

startup settings

using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer;
using DevExpress.DataAccess;
using DevExpress.XtraReports.Web.Extensions;
using DevExpress.XtraReports.Web.ReportDesigner.Services;
using DevExpress.XtraReports.Web.WebDocumentViewer;
using Kuys.Framework.Reporting;
using Kuys.Shared.AspNetCore.DevExp.Reporting.HttpApi.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.Modularity;

namespace Kuys.Shared.AspNetCore.DevExp.Reporting.HttpApi
{
    [DependsOn(typeof(KuysFrameworkReportingModule))]
    public class KuysSharedAspNetCoreDevExpReportingHttpApiModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure<AbpAntiForgeryOptions>(options =>
            {
                options.AutoValidateFilter = type => !type.Namespace.StartsWith("Kuys.Shared.AspNetCore.DevExp.Reporting.HttpApi");
            });

            context.Services.AddDevExpressControls();

            context.Services.AddMvcCore().ConfigureApplicationPartManager(x =>
            {
                var parts = x.ApplicationParts;
                var aspNetCoreReportingAssemblyName = typeof(WebDocumentViewerController).Assembly.GetName().Name;
                var reportingPart = parts.FirstOrDefault(part => part.Name == aspNetCoreReportingAssemblyName);
                if (reportingPart != null)
                {
                    parts.Remove(reportingPart);
                }
            });

            context.Services.ConfigureReportingServices(configurator =>
            {
                configurator.ConfigureWebDocumentViewer(viewerConfigurator =>
                {
                    viewerConfigurator.UseCachedReportSourceBuilder();
                });
            });

            context.Services.AddTransient<ReportStorageWebExtension, CustomReportStorage>();
            context.Services.AddScoped<IWebDocumentViewerReportResolver, CustomWebDocumentViewerReportResolver>();
            context.Services.AddScoped<ObjectDataSourceInjector>();
            context.Services.AddScoped<PreviewReportCustomizationService, CustomPreviewReportCustomizationService>();
            context.Services.AddScoped<IWebDocumentViewerExportResultUriGenerator, CustomWebDocumentViewerExportResultUriGenerator>();
            context.Services.AddScoped<IExportResultProvider, CustomWebDocumentViewerExportResultUriGenerator>();
        }

        public override void OnApplicationInitialization(ApplicationInitializationContext context)
        {
            var app = context.GetApplicationBuilder();

            app.UseDevExpressControls();
        }
    }
}

hi

I only implemented the ScopedServiceProvider. no other linq querys.

Can you try to query in an uow?

https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work

Thank you,

I have already add UnitOfWork attribute but it didn't work.. After making sure that the example you gave is working, I found that it doesn't work because I didn't add virtual to method

        [HighlightedMember]
        [UnitOfWork(isTransactional: false)]
        public **virtual** IEnumerable<ToWhomItMayConcernReportModel> Get(Guid id, string lang = "tr")
        {
                var result = _employeeRepository.AsQueryable().ToList(); 
                
                ...
        }

I dont use multiple context, this linq working in application service. Can you send the project you solved before?

Hi maliming, today i tried with join its throw error

System.InvalidOperationException: 'Cannot use multiple context instances within a single query execution. Ensure the query uses a single context instance.'

Yes, thank you

context.Services.TryAddSingleton(typeof(IScopedServiceProvider<ReportingDataSourceService>), typeof(ScopedServiceProvider<ReportingDataSourceService>));

Then that was the problem, i was inject it scoped

I sent the test project as an e-mail.

🙂

Hi, i tried now but i got error, what is lifetime IScopedServiceProvider, Scoped or Transient

76 kayıttan 21 ile 30 arası gösteriliyor.
Made with ❤️ on ABP v8.2.0-preview Updated on Mart 25, 2024, 15:11