Sorry about the confusion, but the original question title is incorrect and I have changed that. What I am trying to work is how do make my custom Application Services accessable to my .js files ? I am still a bit confused since only the Services created by the RAD tool work in JQuery. I know it will be something simple but the more I read the more it makes no sense to me.
So here is the Interface that was generated by the RAD tool (with a small edit afterwards)
public interface ISuperFundsAppService : IApplicationService
{
Task<PagedResultDto<GetSuperFundForView>> GetAll(GetAllSuperFundsInput input);
Task<GetSuperFundForEditOutput> GetSuperFundForEdit(EntityDto<long> input);
Task CreateOrEdit(CreateOrEditSuperFundDto input);
Task Delete(EntityDto<long> input);
Task<FileDto> GetSuperFundsToExcel(GetAllSuperFundsForExcelInput input);
Task<List<ComboboxItemDto>> GetSuperComboItems(long? selectedId = null);
}
I then created a new interface for processing dropdowns
public interface ISuperFundLookupAppService : IApplicationService
{
List<ComboboxItemDto> GetSuperFundTypeComboItems(int? selectedId = null);
string GetSuperFundTypeFromID(int inputId);
List<ComboboxItemDto> GetSuperFundPaymentFrequencyComboItems(int? selectedId = null);
string GetSuperFundPaymentFrequencyFromID(int inputId);
List<ComboboxItemDto> GetSuperFundPaymentMethodComboItems(int? selectedId = null);
string GetSuperFundPaymentMethodFromID(int inputId);
}
I added the new controller to the MVC - Controller
[Area("App")]
[AbpMvcAuthorize(AppPermissions.Pages_SuperFunds)]
public class SuperFundsController : epaydayControllerBase
{
private readonly ISuperFundsAppService _superFundsAppService;
private readonly ISuperFundLookupAppService _superFundLookupAppService;
private readonly IValueTranslationAppService _valueTranslationAppService;
public SuperFundsController(
ISuperFundsAppService superFundsAppService,
ISuperFundLookupAppService superFundLookupAppService,
IValueTranslationAppService valueTranslationAppService)
{
_superFundsAppService = superFundsAppService;
_superFundLookupAppService = superFundLookupAppService;
_valueTranslationAppService = valueTranslationAppService;
}
Part of the index.js
(function () {
$(function () {
var _$superFundsTable = $('#SuperFundsTable');
var _superFundsService = abp.services.app.superFunds;
var _entityTypeFullName = 'epayday.Epayday.SuperFunds.SuperFund';
But I can't access the lookup service with something like
abp.services.app.superFundLookup
So this guide explains that I can setup an application service and it can then be accessed.
https://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API
Problem I have is that the Application Services which were created by the RAD tool are available in the generated JQuery files. But the Application Services I added later aren't, what do I need to update so they are available ?
Keep in mind I am having existing problems accessing abp.custom.EntityHistory so maybe they are related ?
Abp v4.1.0 ASP.NET CORE MVC & jQuery .NET Core 2.2 v6.4.0
My solution is Auditing Entities and I can see the changes in the Database table and Admin pages.
What do I need to do to get this button/dropdown option working in the various Index.js for each Index page ?
var _entityTypeHistoryModal = app.modals.EntityTypeHistoryModal.create();
function entityHistoryIsEnabled() {
return abp.custom.EntityHistory &&
abp.custom.EntityHistory.IsEnabled &&
_.filter(abp.custom.EntityHistory.EnabledEntities, entityType => entityType === _entityTypeFullName).length === 1;
}
........
{
text: app.localize('History'),
visible: function () {
return entityHistoryIsEnabled();
},
action: function (data) {
_entityTypeHistoryModal.open({
entityTypeFullName: _entityTypeFullName,
entityId: data.record.paidBy.id
});
}
},
When I used to the tool to add an entity it generated an error in projectDBContext.cs, simple fix of course just want to let you guys know than when you create an entity starting with the letter e it breaks the add-migration and update-database stages. I went with the second letter of the entity as a fix.
modelBuilder.Entity<Employee>(e =>
{
e.HasIndex(e => new { e.TenantId });
});
To =>
modelBuilder.Entity<Employee>(m =>
{
m.HasIndex(e => new { e.TenantId });
});
Thanks for the prompt response.
I read through https://aspnetboilerplate.com/Pages/Documents/Localization which gives some insight to how languages/culture are handled in ASP.NET Zero
At ..Migrations.Seed.Host.DefaultLanguagesCreator I changed
new ApplicationLanguage(tenantId, "en", "English", "famfamfam-flags us"),
to
new ApplicationLanguage(tenantId, "en-AU", "English", "famfamfam-flags au"),
At ..Migrations.Seed.Host.DefaultSettingsCreator I changed
AddSettingIfNotExists(LocalizationSettingNames.DefaultLanguage, "en");
to
AddSettingIfNotExists(LocalizationSettingNames.DefaultLanguage, "en-AU");
Finally I changed the default Localization XML file
<localizationDictionary culture="en">
to
<localizationDictionary culture="en-AU">
These changes ensure that all localized tags now display correctly and not with the [] characters. Is this enough to ensure when I migrate the solution to Azure or similar it will work correctly ? The rationale behind this is the US date format will cause a LOT of grief for our customers and since this will be a domesitic product initially it is better if I remove the US option at least for now.
If these changes are correct I could someone who works for ASP.NET Zero please consider adding chaning the default language as a tutorial ? Also it might be a good idea to also add a section on how to add a new language. As ASP.NET Zero becomes more popular I think there will be more non-American developers who will need to want to do this. That or at least add a en-UK language since most Commonwealth nations use the UK date format.