Thank you for the answer but I should maybe have skipped the part of getting the source and running the command because I have the exact same problem with clicking the "Replace packages with source code" button.
So my questions are
Sorry if I was unclear in my previous question.
I´m trying out the module system by changing source code for the Account module (the login screen).
But I get when running the project I get the following error for the IdentityServer
Here is what I´m doing
abp add-module Volo.Account.Pro
that adds nuget package references to 4 projects (Application,Contracts,Blazor,IdentityServer) and an [DependsOn(typeof(AbpAccountPublicWebModule))]
to their respected *Module.cs classes.So I'm I missing somthing (and is it in the documentation?) or is something broken?
ABP Framework version: v4.3.2 (Suite 4.3.3) UI type: Blazor DB provider: EF Core Identity Server Separated: yes
p.s For others I will probably just follow "Customization Overriding Components" and "How to customize the login page of an ABP Blazor application" to customize the login window since the docs reccoment "If you want to make huge changes or add major features on a pre-built module, but the available extension points are not enough, you can consider to directly work the source code of the depended module" but I'm doing a small change at this time but will probably in the future.
e.s Changes done with "How to customize the login page of an ABP Blazor application" are not reflected in the login screen most likely because I have a separate identiyserver. So now I really need assistance with this!
Stacktrace
[09:43:56 FTL] .IdentityServer terminated unexpectedly!
System.IO.FileNotFoundException: Could not load file or assembly 'Volo.Abp.Account.Pro.Public.Web, Version=4.3.2.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Volo.Abp.Account.Pro.Public.Web, Version=4.3.2.0, Culture=neutral, PublicKeyToken=null'
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder
1 derivedAttributes) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit)
at Volo.Abp.Modularity.AbpModuleHelper.FindDependedModuleTypes(Type moduleType)
at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesResursively(List1 moduleTypes, Type moduleType, ILogger logger, Int32 depth) at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesResursively(List
1 moduleTypes, Type moduleType, ILogger logger, Int32 depth)
at Volo.Abp.Modularity.AbpModuleHelper.FindAllModuleTypes(Type startupModuleType, ILogger logger)
at Volo.Abp.Modularity.ModuleLoader.FillModules(List1 modules, IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.Modularity.ModuleLoader.GetDescriptors(IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.Modularity.ModuleLoader.LoadModules(IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.AbpApplicationBase.LoadModules(IServiceCollection services, AbpApplicationCreationOptions options) at Volo.Abp.AbpApplicationBase..ctor(Type startupModuleType, IServiceCollection services, Action
1 optionsAction)
at Volo.Abp.AbpApplicationWithExternalServiceProvider..ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction) at Volo.Abp.AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action
1 optionsAction) at Volo.Abp.AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action
1 optionsAction)
at .Startup.ConfigureServices(IServiceCollection services) in C:\Dev...\aspnet-core\src.IdentityServer\Startup.cs:line 10
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at .Program.Main(String[] args) in C:\Dev...\aspnet-core\src.IdentityServer\Program.cs:line 31
C:\Dev...\aspnet-core\src.IdentityServer\bin\Debug\net5.0.IdentityServer.exe (process 13924) exited with code 1.
Ok it works now. The email was checked with permissions but some combination of loging into the main admin and checking the tenant user loggin of and into the tenant it self and restart made this all click. I really tried this all yesterday as well... strange.... but oh well...closing this
Hi
Since this ticket is closed I´m forced to create a new one.
I have the exact problem with Blazor WASM 4.3.2, that the content on the Settings page is missing when logged in as tenant, but the suggested fix in the above ticket doesn´t solve it.
The following code doesn´t seem to do anything when placed (anywhere) in the Define() method in the PermissionDefinitionProvider class
var setting = context.GetPermissionOrNull(SettingManagementPermissions.Emailing);
setting.MultiTenancySide = MultiTenancySides.Both;
Am I missing something?
Here you can see the Settings menu item but totally empty page.
You are correct @abpVAndy.. I wanted validation on my code setup when working with related entities and if my usage of navigation properties were correct. I found the given answer sourly lacking so I gave up asking this question and just kept my code as it is above, correct or not...
I started out trying to be a DDD/abp.io-framework purist but there some many things to learn there I can´t let it stop me, so I just plow ahead and try to read and re-read the docs.
At some point when I have got every thing running (my style) I´m thinking of paying for a 1-on-1 code-review and coaching. Thats why my code is now littered with //REVIEW: comments where I need future validation.
One thing I like to add is that I find the docs missing more complex real-world examples.
That is why I have been asking lot of these kind of questions so others might gain from them. It would fantastic if they spur somebody on to create some.
And please excuse me if I'm telling you something you already know! Regradless this might help somebody else.
They are basically something (foreign keys relationship/association) to connect entities together.
Lets say you have some XXX entity that has these navigation properies e.g. like this public Guid? SomeRelatedEntityId { get; set; }
and you use GetAsync(id) method (on XXX) you will get every property set on XXX but you will only get a guid to SomeRelatedEntity and not is properties.
If you then wanted to update the values in that entity/table you will have to call GetAsync(someRelatedEntityId) on the SomeRelatedEntityRepository to get the properties you need to update.
With GetXXXWithNavigationProperties methods you will get XXX with SomeRelatedEntity with all its properies filled out and ready to be displayed/used. You don´t need to call again (note that now you are getting more data and maybe not just what you need).
And now you enter the crux of my question: In Create/Update methods of XXXEntity, is it considered OK to mix the domain objects by calling insert/update on all the navigation properties like this here below.
public async Task<MyEventDto> CreateAsync(MyEventCreateAndUpdateDto input)
{
var newMyEvent = new MyEvent();
// Create navigation entities and map input data to their respected properties
var common = new Common(GuidGenerator.Create()){ Name = input.Name, etc... }
var settings = new Settings(GuidGenerator.Create()){ /*set properties*/ }
var geoRestriction = new GeoRestriction(GuidGenerator.Create()){ /*set properties*/}
// Insert everything to their respected repositories
// First I thought that this was incorrect "mixing" domains,
// but the CreateAsync is a Service so the domains are not mixing..correct?
var _common = await _commonRepository.InsertAsync(common, autoSave: autoSave);
var _settings = await _settingsRepository.InsertAsync(settings, autoSave: autoSave);
var _geo = await _geoRestrictionRepository.InsertAsync(geo, autoSave: autoSave);
// "Connect" the inserted id's to MyEvent
newMyEvent.CommonId = _common.Id;
newMyEvent.SettingsId = _settings.Id;
newMyEvent.GeoRestrictionId = _geoRestriction.Id;
newMyEvent.TenantId = CurrentTenant.Id;
// Save everything connected.. if anything fails above UnitOfWork will see to it that nothing gets saved.
var myEvent = await _MyEventRepository.InsertAsync(newMyEvent);
// Returns MyEvent that only has ids.
// You call GetXXXWithProperties again in your UI/Client code to get them.
// Or you could create another CreateAsync method that returns another object with everything,
// but that ofcourse depends on your use case
return ObjectMapper.Map<MyEvent, MyEventDto>(myEvent);
}
Is this the correct approach? It feels little too manual.. Should I maybe inject ICommonAppService, ISettingsAppService etc. into MyEventService and use their service methods to insert/update (like this example of MyService using the BookAppService)? But then you would loose UnitOfWork correct?
Awesome thank you! My "search-fu" was way off! I wanted to check this out way before my deadline but this will be up after 2-3 weeks for me so I´ll give you feedback then. Thanks again!
I need to implement the payment gateway provider Rapyd and I would like to know what is my best approach to it?
I see that the abp.io payment module only supports 4 gateways and not one of them supports my local currency (ISK).
What would you reccommend I should do?
Any change you could add Rapyd to the payment module?
See Growing At 400%, Rapyd Takes On PayPal In $160 Trillion B2B Payments Market
The code above works but what is the correct approach?
So after finally getting some code to look at Easy CRM example I see that I´m probably doing this incorrectly.
Here is what I got from that code.
This is one-to-one relationship
Create a MyEvent entity with the desired relations in the Domain
public class MyEvent : FullAuditedAggregateRoot<Guid>
{
public virtual Guid? TenantId { get; set; }
public virtual string Name { get; set; }
public virtual Guid? CommonId { get; set; }
public virtual Common Common { get; set; }
public virtual Guid? SettingsId { get; set; }
public virtual Settings Settings { get; set; }
public virtual Guid? GeoRestrictionId { get; set; }
public virtual GeoRestriction GeoRestriction { get; set; }
public virtual ICollection<Stuff> Stuff { get; set; }
}
an just for completness I´ll show one related entity
public class Common : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; set; }
public virtual string Address { get; set; }
public virtual MyEvent MyEvent { get; set; }
}
then in Contracts we have these two dto's where one is lighter with only ids and the other extended one with the dto-entities I'm working with
public class MyEventDto : FullAuditedEntityDto<Guid>
{
public virtual string Name { get; set; }
public Guid CommonId { get; set; }
public Guid SettingsId { get; set; }
public Guid GeoRestrictionId { get; set; }
}
public class MyEventCreateAndUpdateExtendedDto : OrderDto
{
public CommonDto Common { get; set; }
public SettingsDto Settings { get; set; }
public GeoRestrictionDto GeoRestriction { get; set; }
public List<StuffDto> Stuffs { get; set; }
}
I ended up not needing this relationship setup, but I´ll keep it here anyways
builder.Entity<MyEvent>(b =>
{
b.ToTable(MyEventConsts.DbTablePrefix + "MyEvent", MyEventConsts.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired();
//This was not needed (because of EF picked up conventions used)
//b.HasOne(x => x.Common).WithOne(x => x.MyEvents).HasForeignKey(x => x.CommonId).IsRequired();
// b.HasOne(x => x.Settings).WithOne(x => x.MyEvents).HasForeignKey(x => x.SettingsId);
//b.HasOne(x => x.GeoRestriction).WithOne(x => x.MyEvents).HasForeignKey(x => x.GeoRestrictionId);
// b.HasMany(x => x.Stuff).WithOne(x => x.MyEvent).HasForeignKey(x => x.MyEventId);
});
then create MyEvent by call this method in the AppService
[Authorize(MyPermissions.MyEvents.Create)]
public virtual async Task<MyEventDto> CreateAsync(MyEventCreateAndUpdateExtendedDto input)
{
var newMyEvent = ObjectMapper.Map<MyEventCreateAndUpdateExtendedDto, MyEvent>(input);
newMyEvent.TenantId = CurrentTenant.Id;
var common = new Common(GuidGenerator.Create()){ Name = input.Name, etc... }
var settings = new Settings(GuidGenerator.Create()){ /*set properties*/ }
var geoRestriction = new GeoRestriction(GuidGenerator.Create()){ /*set properties*/}
newMyEvent.Common = common;
newMyEvent.Settings = settings;
newMyEvent.GeoRestriction = geoRestriction;
var myEvent = await _MyEventRepository.InsertAsync(newMyEvent);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<MyEvent, MyEventDto>(myEvent);
}
And now I can use GetWithNavigationPropertiesAsync(id)
to get them all back.
So could anybody chime in and tell me **what is the best approach **and if I´m on the right track or not?
Sorry for the long rant.. but if nobody answers me I just need to work this out for my self and learn something and hopefully help the next poor bastard that is trying to get this all to click :-)
Or would it make more sence to use Domain Service here?
I can see the value in using the Domain Service if I had some business logic (maybe using specifications) so I would contain my business logic there but not in the AppService. So I still think that I should use it like I did in my question but I would like a confirmation
[Authorize(MyPermissions.MyEvent.Create)]
public virtual async Task<MyEventDto> CreateAsync(MyEventCreateDto input)
{
var myEvent = ObjectMapper.Map<MyEventCreateDto, MyEvent>(input);
// Call the manager
myEvent = await myEventManager.CreateAsync(myEvent,common,settings,geoRestriction, autoSave: true);
myEventManager.Update(myEvent);
return ObjectMapper.Map<MyEvent, MyEventDto>(myEvent);
}
public class MyEventManager : DomainService
{
private readonly IRepository<MyEvent, Guid> myEventRepository;
private readonly IRepository<Common, Guid> commonRepository;
private readonly IRepository<Settings , Guid> settingsRepository;
private readonly IRepository<GeoRestriction , Guid> geoRestrictionRepository;
public IssueManager(IRepository<MyEvent, Guid> myEventRepository, Common, Guid> commonRepository, etc)
{
this.myEventRepository = myEventRepository;
this.commonRepository = commonRepository;
//etc.
}
public async Task CreateAsync(MyEvent myEvent, Common common, Settings settings, GeoRestriction geo, bool autoSave)
{
var _common = await _commonRepository.InsertAsync(common, autoSave: autoSave);
var _settings = await _settingsRepository.InsertAsync(settings, autoSave: autoSave);
var _geo = await _geoRestrictionRepository.InsertAsync(geo, autoSave: autoSave);
myEvent.CommonId = _common.Id;
myEvent.SettingsId = _settings.Id;
myEvent.GeoRestrictionId = _geoRestriction.Id;
myEvent.TenantId = CurrentTenant.Id;
}
}
I'm just writing this all down so I can better grasp DDD and hopefully help somebody else when they go down this route so please bear with me :-)
This is probably a two-fold but related question:
I have a page with data, that when saved, creates MyEvent. The page contains few things that I like to separate out (not be in the same table) so I can use it later somewhere else. See image at bottom
When I use Suite I create the following entities
where CommonId,SettingsId and GeoRestrictionId are navigation properties on MyEvent.
This way I can (in MyEventAppService) use the GetWithNavigationPropertiesAsync() method and get the related entities directly into the service (or GetAsync() if I just want the ids to query and use later).
So far so good?
If so then whats the best practice to create MyEvent with the navigationproperties in one go?
Would it be fine to do it like this in MyEventAppService? Will this use unit-of-work (if one insert fails all fails)?
[Authorize(MyPermissions.MyEvent.Create)]
public virtual async Task<MyEventDto> CreateAsync(MyEventCreateDto input)
{
var myEvent = ObjectMapper.Map<MyEventCreateDto, MyEvent>(input);
// Insert Common/Settings/GeoRestriction and get their id's
var commontemp = new Common(GuidGenerator.Create()){ Name = input.Common.Name, etc... }
var common = await _commonRepository.InsertAsync(commontemp, autoSave: true);
...
... same for Settings and GeoRestriction
// then "hook" it together by addin their ids to myEvent and save
myEvent.CommonId = common.Id;
myEvent.SettingsId = settings.Id;
myEvent.GeoRestrictionId = geoRestriction.Id;
myEvent.TenantId = CurrentTenant.Id;
myEvent = await _myEventRepository.InsertAsync(myEvent, autoSave: true);
return ObjectMapper.Map<MyEvent, MyEventDto>(myEvent);
}
I really feel like I have got this down just by writing the question but would like to know for sure.