aspnetboilerplate

How to use and display PagedResultDto

六眼飞鱼酱① 提交于 2019-12-06 16:09:17
Using ASPNet Boilerplate, and returning a pagedResultSetDto with the below code, how do I display the page links? public PagedResultDto<ArticleDto> GetAll() { var articleCount = articleRepository.Count(); var t = articleRepository.GetAllIncluding(x => x.articleImage).Include(x => x.Category).Where( x => x.PublishFrom <= DateTime.Now && x.PublishTo >= DateTime.Now && x.Status == PostStatus.Published && x.IsDeleted == false ).OrderByDescending(x=> x.PublishFrom).ToList(); return new PagedResultDto<ArticleDto> { TotalCount = articleCount, Items = t.MapTo<List<ArticleDto>>() }; } First, take in

Calling SignalR service from a BackgroundWorker in ABP

风格不统一 提交于 2019-12-06 15:35:47
I have a BackgroundWorker which is supposed to broadcast something to all online clients in 5 seconds interval: DeactivationBackgroundWorker: public class DeactivationBackgroundWorker : PeriodicBackgroundWorkerBase, ISingletonDependency { private readonly IRepository<HitchRequest, long> _hitchRequestRepository; private readonly IHitchHub _hitchHub; public DeactivationBackgroundWorker(AbpTimer timer, IRepository<HitchRequest, long> hitchRequestRepository, IHitchHub hitchHub) : base(timer) { _hitchRequestRepository = hitchRequestRepository; Timer.Period = 5000; _hitchHub = hitchHub; } protected

ASP.NET Boilerplate MVC 5.x template fails to start

主宰稳场 提交于 2019-12-06 14:38:28
After downloading ASP.NET MVC 5.x template, I update the connection string, restore NuGet packages and then try to run Update-Database command in Package Manager Console, but I consistently get the following error: Could not load file or assembly 'Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) I was able to solve this once by removing all packages and adding them back one at a time, but this is extremely time

Uploading image in ASP.NET Boilerplate

女生的网名这么多〃 提交于 2019-12-06 11:20:34
When posting an image, HttpContext.Current.Request is null . Is there any simple way to achieve this? I am using dropzone.js on client side. Project is Angular with Web API (ASP.NET Core 2.0) template. [HttpPost] public HttpResponseMessage UploadJsonFile() { HttpResponseMessage response = new HttpResponseMessage(); var httpRequest = HttpContext.Current.Request; if (httpRequest.Files.Count > 0) { foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; var filePath = HttpContext.Current.Server.MapPath("~/UploadFile/" + postedFile.FileName); postedFile.SaveAs

How to get more detailed exception in ABP?

老子叫甜甜 提交于 2019-12-04 21:14:00
问题 I created a CrudAppService. When I invoke its dynamic API by using swagger , I get a generic 500 error with this description: { "result": null, "targetUrl": null, "success": false, "error": { "code": 0, "message": "An internal error occurred during your request!", "details": null, "validationErrors": null }, "unAuthorizedRequest": false, "__abp": true } How can I get a more detailed exception to debug? Is there something I have to enable? 回答1: Check error in Logs.txt . From the documentation

Implement OrganizationUnit filter in ASP.NET Core

大城市里の小女人 提交于 2019-12-04 19:38:03
In ASP.NET Boilerplate, there are built-in Data Filters like Tenant filter, and we could use SetTenantId to enable querying specific tenantId . As per the official document, it did not support custom Filter in EF Core, unlike EF 6.x. I am wondering how to achieve a similar filter for OrganizationUnitId parameter. This is what I have done so far: Override CreateFilterExpression : protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>() { Expression<Func<TEntity, bool>> expression = null; if (typeof(IMayHaveOrganizationUnit).IsAssignableFrom(typeof(TEntity))) {

How to call web API under specific user permission?

陌路散爱 提交于 2019-12-04 05:49:13
问题 I have a function that allows the end user to execute a Workflow (containing many APIs) or schedule it to run as a background job. Example: User1 creates Workflow1 , which contains 3 APIs ( Api1 , Api2 , Api3 ), and configures it to run at 9AM every day. I use HttpClient to call each API like this: var client = new HttpClient { BaseAddress = new Uri("http://localhost/") }; client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage

How to get more detailed exception in ABP?

坚强是说给别人听的谎言 提交于 2019-12-03 13:43:38
I created a CrudAppService. When I invoke its dynamic API by using swagger , I get a generic 500 error with this description: { "result": null, "targetUrl": null, "success": false, "error": { "code": 0, "message": "An internal error occurred during your request!", "details": null, "validationErrors": null }, "unAuthorizedRequest": false, "__abp": true } How can I get a more detailed exception to debug? Is there something I have to enable? Check error in Logs.txt . From the documentation on Logging : Configuration All configuration is done for Log4Net when you create your application from ASP

Invalid Tenancy Name

穿精又带淫゛_ 提交于 2019-12-03 09:15:27
I am working on an ASP.NET Boilerplate service project. When I am saving a client, it returns an error: Tenancy Name is not valid The tenancy name contains spaces. TenantDto maps to Tenant object without any error. Database table TenancyName column is nvarchar(64) . Error occurs when it is saving. From the documentation on Tenant Management : AbpTenant class defines some base properties, most important ones are: TenancyName : This is unique name of a tenant in the application. It should not be changed normally. It can be used to allocate subdomains to tenants like ' mytenant .mydomain.com'.

Locale DateTime in ABP

 ̄綄美尐妖づ 提交于 2019-12-02 21:07:22
问题 I have a DateTime field in popup modal as below that is supposed to only show the time part: HTML: <div class='input-group date'> <input class="form-control" type="datetime" #RequiredByDate name="RequiredByDate" [value]="formatDate(hitchRequest.requiredByDate, 'LT')" required> <span class="input-group-addon"> <span class="fa fa-clock-o"></span> </span> </div> TS: formatDate(date: any, format: string): string { if (!date) { return ''; } return moment(date).format(format); } onShown(): void { $