Dear Team, i used the abp generate-proxy -t csharp -url https://localhost:44358 command and generated c# client proxies. Now i created a new empty blazor app using "dotnet new blazorwasm -o ProMailNet.BlazorWasm" and would like to use this proxy by injecting it. Is there any way to achieve that ?
I was able to inject it into my program.cs and referenced the project http.client.
builder.Services.AddScoped<MailboxClientProxy>();
but when i try to call a method from the mailboxclientproxy :
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Uncaught (in promise) Error: Volo.Abp.AbpException: WebAssemblyCachedApplicationConfigurationClient should be initialized before using it.
would really appreciate your help. as i am trying to create an empty blazor app but use the proxies. The reason for that is that currently my blazor application hosted on https://uat.promailnet.com takes upto 6 seconds before reaching the appliction-configuration call which is leading to super slow load time. everytime you refresh it does the same thing. it caches everything else, but this call takes 6 seconds to initiate, so im starting with a blank template as i only require the proxies for some app services. I am handling everything else
Dear support team, How do I authenticate and attach the JWT token to the authorization header without having to use the default Microsoft Identity Authentication page ?
The reason why I am asking this is because i am trying to create my own custom login page without having to customize the existing one and create a seamless login experience without having to redirect to Microsoft identity and then redirect back once logged in.
Best Regards, Fathi Alsharif
Hello,
I am trying to customize the tenant creation view like below. I created the new folder and files following the same path as the documentation (Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor) , https://github.com/abpframework/abp/tree/dev/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement. I added [Dependency(ReplaceServices = true)]. I tried to add a textfield to test it but it is not affected or showing, I also tried to add a breakpoint in the razor.cs file (the code behind) it also was not get hit.
Hi Team, How Can you i override the default behavior for handling exceptions and displaying the blazorise Dialog that is currently implemented by default in the blazor Project ? I am trying to display my own design for the Dialog that is displayed on backend exceptions
Dear Support team, Is there a blank blazor template that i can use in which i can exclude the blazorize template, create my own login page and still be able to use the generated application services directly into it without having to depend on the identity login page ? I can still use the original template to do tenant management and all of that but i am looking for a clean template that i can use without the blazorize bloatware The issue that i am having right now , is that i am trying to use Mudblazor with the new .net 6 blazor template but iam runinng into alot of UI issues. I would love to be able to create my own login page and have the token in the header of every api call without having to use the existing template that comes with ABP suite. Do you have any solutions or ideas ?
HI Team, first of all thanks for always being prompt on answering my questions.
This is a bit of a noob question but i would appreciate your help.
I am integrating with a delivery company to process my orders and ive created this appservice with an endpoint for the delivery company to call when they change status of my order :
public class SwftBoxAppService : DukkantekAppService, ISwftBoxAppService
{
private readonly IRequestsManager _requestsManager;
private readonly IRequestRepository _requestRepository;
private readonly IDataFilter _dataFilter;
public SwftBoxAppService(IRequestsManager requestsManager, IRequestRepository requestRepository,
IDataFilter dataFilter)
{
_requestsManager = requestsManager;
_requestRepository = requestRepository;
_dataFilter = dataFilter;
}
[HttpPost]
public async Task Update(SwftBoxWebhookInput input)
{
using (_dataFilter.Disable<IMultiTenant>())
{
var request =
(await _requestRepository.GetQueryForNavigationPropertiesAsync()).SingleOrDefault(c =>
c.Request.RequestNumber == input.merchant_order_id);
if (request == null)
{
throw new UserFriendlyException("Could not find this request");
}
await _requestsManager.UpdateSwftBoxWebhook(request, input);
}
}
My question is , how do i secure this enpoint for them to use.
shall i be creating a new client for them in identity clients ? How do i give them an API KEY or something to access that endpooint ??
ABP 4.2 .net 5
so i extended tenant entity and added few more fields to it. Its now named Shop this is a single database with more than 200 tenenats , i am trying to display a grid that shows each tenant and Total Transactions done by them .
SHOP TOTAL TRANSACTIONS TOTAL ORDERS
Ravenmart 1222 USD 55
My Invoice entity : <br>
public class Invoice : FullAuditedAggregateRoot, IMultiTenant
{
public Invoice(Guid id, Guid? tenantId, bool isWalkIn, PaymentTypeEnums paymentTypeId,
InvoiceTypeEnum invoiceTypeId) : base(id)
{
TenantId = tenantId;
Total = new decimal(2);
Vat = new decimal(2);
InvoiceNumber = AnGenerator.RandomString(5);
IsWalkIn = isWalkIn;
PaymentTypeId = paymentTypeId;
InvoiceTypeId = invoiceTypeId;
InvoiceStatusId = InvoiceStatusEnum.Unpaid;
InvoiceStatusName = Enum.GetName(InvoiceStatusEnum.Unpaid);
}
public Guid? TenantId { get; }
+ some other fields
This is my Shop Repository : <br>
public class ShopRepository : EfCoreRepository<DukkantekDbContext, Shop, Guid>, IShopRepository
{
public ShopRepository(IDbContextProvider dbContextProvider)
: base(dbContextProvider)
{
}
public async Task<List<ShopWithNavigationProperties>> GetListWithNavigationPropertiesAsync(
bool isOnlineStoreEnabled,
string filter,
string sorting = null,
int maxResultCount = int.MaxValue,
int skipCount = 0, CancellationToken cancellationToken = default)
{
var query = await GetQueryForNavigationPropertiesAsync();
query = ApplyFilter(query, filter,isOnlineStoreEnabled);
return await query.PageBy(skipCount, maxResultCount).ToListAsync(cancellationToken);
}
public async Task<long> GetCountAsync(
bool isOnlineStoreEnabled,
string filter,
string sorting = null,
CancellationToken cancellationToken = default)
{
var query = ApplyFilter((await GetQueryForNavigationPropertiesAsync()), filter,isOnlineStoreEnabled );
return await query.LongCountAsync(GetCancellationToken(cancellationToken));
}
protected virtual IQueryable<ShopWithNavigationProperties> ApplyFilter(
IQueryable<ShopWithNavigationProperties> query,
string filter,
bool isOnlineStoreEnabled
)
{
return query
.WhereIf(isOnlineStoreEnabled is true, u => u.Shop.IsOnlineStoreEnabled == true)
.WhereIf(isOnlineStoreEnabled is false, u => u.Shop.IsOnlineStoreEnabled == false)
.WhereIf(!filter.IsNullOrWhiteSpace(), u => u.Shop.StoreName.Contains(filter));
}
public virtual async Task<IQueryable<ShopWithNavigationProperties>> GetQueryForNavigationPropertiesAsync()
{
return from shop in (await GetDbSetAsync())
join invoice in (await GetDbContextAsync()).Invoices.DefaultIfEmpty() on shop.Id equals invoice.TenantId into invoices
from invoice in invoices.DefaultIfEmpty()
select new ShopWithNavigationProperties()
{
Shop = shop,
Invoice = invoice,
};
}
}
Heres my issues : in my ShopAppservice , i have the following code : <br>
public async Task<PagedResultDto> GetAllWithDetails(GetShopsInput input)
{
using (_dataFilter.Disable())
{
var shopst = (await _shopRepository.GetListWithNavigationPropertiesAsync(input.IsOnlineStoreEnabled,
input.Filter, input.Sorting, input.MaxResultCount, input.SkipCount)).ToList();
var shops = shopst
.GroupBy(s => s.Shop.Id, (c, i) =>
{
var shopWithNavigationPropertiesList = i.ToList();
return new ShopWithNavigationPropertiesDto()
{
Shop = ObjectMapper.Map<Shop, AppTenantDto>(shopWithNavigationPropertiesList.First().Shop),
TotalOrders = shopWithNavigationPropertiesList.Select(t => t.Request)
?.Count(p => p is {RequestStatusId: RequestStatusEnum.Completed}),
TotalTransactions = shopWithNavigationPropertiesList.Select(t => t.Invoice).ToList()
?.Where(p => p is {InvoiceStatusId: InvoiceStatusEnum.Paid}).Sum(g => g.GrandTotal),
};
}).ToList();
return new PagedResultDto<ShopWithNavigationPropertiesDto>(
await _shopRepository.GetCountAsync(), shops);
}
}
This is not working properly for me as MAXresultcount limits the total records and i end up with wrong values.
How can i show each shop and the total for his invoices knowing that each invoice has a tenantID ?
please please help as i really dont understand how to work around this DDD issue
Edited for better readability.
hello, i have a products entity , each product can have a product category and product subcategory. in some situations, the product exists in the tenant but the category and sub category only in the host.
i created a custom repository where i have this code where i implemenet datafilter to get host product categories and sub categories :
this unfortunately doesnt work and keeps returning null values for the product category and subcategory. i checked the response in GetHostProductCategories() function and shows the data there if do a .ToList().
I am tring to eventually achieve functionality where if the product category is not in this tenant, then we get it from host..
PS: BOTH TENANT AND HOST ARE IN THE SAME DATABASE
public virtual async Task<IQueryable<ProductWithNavigationProperties>> GetQueryForNavigationPropertiesAsync(
Guid? tenantId=null)
{
var products = (await GetDbSetAsync());
return from product in (products)
join productCategory in await GetHostProductCategories()
on product.ProductCategoryId equals productCategory.Id into productCategories
from productCategory in productCategories.DefaultIfEmpty()
join productSubCategory in await GetHostProductSubCategories()
on product.ProductSubCategoryId equals productSubCategory.Id into productSubCategories
from productSubCategory in productSubCategories.DefaultIfEmpty()
select new ProductWithNavigationProperties()
{
Product = product,
ProductCategory = productCategory,
ProductSubCategory = productSubCategory,
};
}
private async Task<IQueryable<ProductCategory>> GetHostProductCategories()
{
using (DataFilter.Disable<IMultiTenant>())
{
return (await GetDbContextAsync()).ProductCategories;
}
}
private async Task<IQueryable<ProductSubCategory>> GetHostProductSubCategories()
{
using (DataFilter.Disable<IMultiTenant>())
{
return(await GetDbContextAsync()).ProductSubCategories;
}
}
ABP Framework version: v4.2.2 UI type: / Blazor DB provider: EF Core / Tiered (MVC) or Identity Server Separated (Angular): no
i am trying to create a UI inwhich when the user registers using his phone number, the backend autogenerates the password and should return a JWT token ( Same one we get when we authenticate using connect/token endpoint.
How can i authenticate and get a token in the backend programatically so ican send it as a response. ??
public virtual async Task<string> LoginOrRegister(LoginInputDto input) { await CheckSelfRegistrationAsync();
await IdentityOptions.SetAsync();
var user = new IdentityUser(GuidGenerator.Create(), input.PhoneNumber, input.PhoneNumber + "@dukkantek.com", CurrentTenant.Id);
user.SetPhoneNumber(user.UserName,true);
(await UserManager.CreateAsync(user, "#Pp" + input.PhoneNumber)).CheckErrors();
(await UserManager.AddDefaultRolesAsync(user)).CheckErrors();
var token = //code to login this new user and Generate token
return token;
}
Dear team, is there a faster way to run DBMigrator on 1000+ Tenants ? its currently taking hours to finish as it loops through all the tenants one by one, i understand that. But this strategy is causing us to have downtimes when we do schema updates.
Is there a way to keep the system running while migration is running ? is there a faster way to migrate this many databases ? can i migrate them back to a single database ?