Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "rbarbosa"

Hello

We have a few queries that run reports, naturally these take longer than the default 30 seconds when the user. I have tried wrapping the query in a using statement or using the UOW attribute, but when the query times out, the SqlConnection does not show the overriden value

Any ideas on how to set this up?

Hello I am in the process of migrating our app to ABP/Zero 7, backend went great, now on to Angular. I have created a module/folder to house all the custom code to make these upgrades less daunting:

app-routing.module.ts

{
        path: 'wms',
        loadChildren: () => import('app/wms/wms.module').then(m => m.WmsModule), //Lazy load wms module
        data: { preload: true }
}, 

Everything works fine until i have a component that uses the services through DI

routing-log.component.ts

export class RoutingLogComponent extends AppComponentBase implements OnInit {

....

    constructor(
        injector: Injector,
        private _reportService: ReportServiceProxy,
        ) {
            super(injector);
        }

        ngOnInit(): void {
                this._reportService.getReport().....
        }

....

The following error occurs when trying to load the component/page:

ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(RootModule)[RoutingLogComponent -> ReportServiceProxy]: 
  StaticInjectorError(Platform: core)[RoutingLogComponent -> ReportServiceProxy]: 
    NullInjectorError: No provider for ReportServiceProxy!
NullInjectorError: StaticInjectorError(RootModule)[RoutingLogComponent -> ReportServiceProxy]: 
  StaticInjectorError(Platform: core)[RoutingLogComponent -> ReportServiceProxy]: 
    NullInjectorError: No provider for ReportServiceProxy!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:1225)
    at resolveToken (core.js:1463)
    at tryResolveToken (core.js:1407)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1311)
    at resolveToken (core.js:1463)
    at tryResolveToken (core.js:1407)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1311)
    at resolveNgModuleDep (core.js:18446)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:19135)
    at resolveNgModuleDep (core.js:18446)
    at resolvePromise (zone.js:852)
    at resolvePromise (zone.js:809)
    at zone.js:913
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:24328)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:502)
    at invokeTask (zone.js:1693)

I have refreshed nswag and there is a service proxy file with the proper Proxy holding the api call

service-proxies.ts


@Injectable()
export class ReportServiceProxy {
    private http: HttpClient;
    private baseUrl: string;
    protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;

    constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
        this.http = http;
        this.baseUrl = baseUrl ? baseUrl : "";
    }
    .....
    .....
    ....
    }

the wms module is almost identical to the admin module in terms of what imports and declarations are being loaded to make sure i was not missing anything.

Any ideas?

Started reading https://support.aspnetzero.com/QA/Questions/2583 and could not find a way to open it again.

When sending a list or array of complex objects ABP will let you know the index of the object and the property that is having issues, I am trying to use ICustomValidate to hook up to this behavior and check for duplicates on the data, among other things that need a roundtrip to the DB

eg:

    public class AddSkuInput : ICustomValidate
    {
        [MaxLength(35)]
        [Required]
        public string Sku { get; set; }
        
        
        
        public void AddValidationErrors(CustomValidationContext context)
        {
        
            var skuManager = context.IocResolver.Resolve<ISkuManager>();
            var productTypeManager = context.IocResolver.Resolve<IProductTypeManager>();

            try
            {

                AsyncHelper.RunSync(() => skuManager.ValidateDuplicateSkuAsync(Sku)); 
            }
            catch (UserFriendlyException e)
            {
                context.Results.Add(new ValidationResult(e.Message));
            }
      }
    }
    
  
      
      //for brevity this is the ValidateDuplicateSkuAsync Method
      
      public async Task ValidateDuplicateSkuAsync(string input)
        {
            if (await _skuRepository.GetAll().AnyAsync(p => p.Sku == input))
            {
                throw new UserFriendlyException($"SKU {input} already exists.");
            }
        }

With or without AsyncHelper it produces DbContext.Disposed Errors

Users normally send 100s of these items and I would like to deal with the majority of errors in batches too so I'd like to maintain the validation error structure like this response example:

{
    "result": null,
    "targetUrl": null,
    "success": false,
    "error": {
        "code": 0,
        "message": "Your request is not valid!",
        "details": "The following errors were detected during validation.\r\n - The Sku field is required.\r\n - The Upc field is required.\r\n - The Upc field is required.\r\n",
        "validationErrors": [
            {
                "message": "The Sku field is required.",
                "members": [
                    "[0].Sku"
                ]
            },
            {
                "message": "The Upc field is required.",
                "members": [
                    "[0].Upc"
                ]
            },
             {
                "message": "The Upc field is required.",
                "members": [
                    "[1].Upc"
                ]
            }
        ]
    },
    "unAuthorizedRequest": false,
    "__abp": true
}

If keeping Database access out of the DTO is a must, how can i access the ValidationContext after the method has reached the AppService (or the DomainService) as I'd like to maintain the DataAnnotations style error result through every validation process.

Question

Hello,

When trying to add actions after user input to backend exceptions, I am having trouble passing the error message as it gets converted to a standard swagger exception

Backend: throw new UserFriendlyException("Order not found");

Angular:

getOrder(event?:LazyLoadEvent){
            this.orderLoading = true;
            this._returnAppService.getOrder(this.orderText)
            .pipe(finalize(()=> {this.orderLoading = false}))
            .subscribe(result=> {
                this.orderDetails = result;                
            },err=> {
                console.log(err);
                debugger;
                abp.message.error(err.message).then(()=> {
                    this.orderText = "";
                    this.orderTextField.nativeElement.focus();
                    //do more custom stuff
                });
            })
            
        }

the err object is a standard SwaggerException "an internal error has ocurred" but abp.js manages to catch the proper message.

Any ideas on how to properly create custom alerts with callbacks that will pass the error message?

Hi, would it be possible to pass the context without being disposed to a view?

Using DevExpress GridView and their sorting/grouping functionality depends on such IQueryable such example can be found here: <a class="postlink" href="https://www.devexpress.com/Support/Center/Example/Details/E3252">https://www.devexpress.com/Support/Cent ... ails/E3252</a>

on asp.net zero im using this:

public ActionResult AdvancedCustomBindingPartial()
        {
 return PartialView("LocationsTablePartial", _locationMasterRepository.GetAll());
}

I've also done a linq query from the service layer with almost the same results:

using (var unitOfWork = UnitOfWorkManager.Begin())
            {
                var query = _locationAppService.BuildLocationQuery();

                viewModel.ProcessCustomBinding(
                    query.GetDataRowCountAdvanced,
                    query.GetDataAdvanced,
                    query.GetSummaryValuesAdvanced,
                    query.GetGroupingInfoAdvanced,
                    query.GetUniqueHeaderFilterValuesAdvanced
                );
            unitOfWork.Complete();
            return PartialView("LocationsTablePartial", viewModel);
            }

and the exception in the view that follows: '((System.Data.Entity.DbSet<Abp.Location.LocationMaster>)Model).Local' threw an exception of type 'System.InvalidOperationException' "The operation cannot be completed because the DbContext has been disposed."

" at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()\r\n at System.Data.Entity.Internal.Linq.InternalQuery1.GetEnumerator()\r\n at System.Data.Entity.Internal.Linq.InternalSet1.GetEnumerator()\r\n at System.Data.Entity.Infrastructure.DbQuery1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()\r\n at System.Linq.SystemCore_EnumerableDebugView1.get_Items()"

Any ideas?

Hi

I've created a separate assembly inheriting from abpmodule

[DependsOn(typeof(PrizmApplicationModule))]
    public class NeoDynamicsBarcodeModule : AbpModule
    {...}
public interface INeoDynamicsBarcodeService : IApplicationService {
    string CreateLabelTest(string barCode, string labelType);
}
    public class NeoDynamicsBarcodeService : PrizmAppServiceBase, INeoDynamicsBarcodeService    {
       public string CreateLabelTest(string barCode, string labelType) {...}
}

.WebApi Project

[DependsOn(typeof(AbpWebApiModule), typeof(PrizmApplicationModule),
        typeof(NeoDynamicsBarcodeModule))]
    public class PrizmWebApiModule : AbpModule
    {...}

Am I missing anything to expose this to the public API? Initialize() method on the module is happening before the webAPI tries to register everything

Hi

I was wondering if there are set conventions when using views from a plugin, my intention is to create each menu item as a plugin, menu registration works great, but there is no such mechanism to map the routes to the modules, or is it? So far I put the controllers and views in the same folder name structure as the main project, also added the PreStarter class from the documentation : ABP.Web

  • Areas\Mpa [list:22z4hnjc][*:22z4hnjc]Controllers
  • Views[/*:m:22z4hnjc][/list:u:22z4hnjc]

Plugin.Web

  • Areas\Mpa [list:22z4hnjc][*:22z4hnjc]Controllers > Home
  • Views > Index[/*:m:22z4hnjc][/list:u:22z4hnjc]

Do i have to write a Route manager that will inject every plugin route to the Routecollection on load? ideally as /module/something I was hoping to keep it as lean as possible to maintain compatibility with the ABP project. Thanks, Rodrigo

Showing 1 to 7 of 7 entries