Hello,
I have two questions that I am hoping to get some help on...
The first is with regard to the overall appSettings.json file. We would like to fully encrypt this file once it is deployed, and I am trying to figure out where I can put a custom ConfigurationSource in the application to allow this information to be decrypted, prior to handing it off to the rest of the application. Does anyone have an example of how to do this, or can provide some information about what needs to be done here? Is what I am suggesting considered a best practice, or should I be looking towards something else?
The other part of the question is related, as it also appears in the appSettings.json file, and that is the AbpZeroLicenseCode. Is this "ok" to leave in the appSettings.json file? Is it sensitive in anyway, i.e. would we not want other people to get access to this? What are the best practices around securing this information if required?
Thanks
Gary
Hello,
In the generated Index.js files for the entities I have created, I am seeing lines like this:
ajaxFunction: _computersService.getAll,
For querying all the records from the database. I have created a custom method in my controller that I want to call instead of the default getAll method, however, I am unable to find the _computersService defined anywhere to add that method to.
Can someone please point me in the right direction?
Thanks Gary
ismcagdas thank you again! I have just given the _session.Use a try, and it seems to work exactly as I was hoping.
Thanks again!
<cite>ismcagdas: </cite> If you want to make operations on behalf of a user, you can use <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Abp-Session#user-identifier">https://aspnetboilerplate.com/Pages/Doc ... identifier</a>.
Sorry, I am not sure if I follow. Do you have an example of where/when this can be used? Within the Windows Service, I want to be able to "log in" as a user of the system, so that any modifications to the data can be tracked back to where they came form. In this case, we will likely create an account in the system that the Windows Service will use to login to the application, prior to making any changes.
Thanks again!
@ismcagdas thank you for pointing me that the Migrator project. I was able to follow it's module, including the setup of the ServiceCollectionRegistrar, and I was able to get instances of my service being returned from the container.
Thank you very much!
As a follow up question though...
When I try to call the GetAll method on one of my services, I get an exception saying:
Current user did not login to the application.
I have been able to workaround this for now by setting:
Configuration.Authorization.IsEnabled = true;
In my module, but this is far from ideal. Can you point me at where I would Login with a set of credentials to allow all interactions to happen using that user?
@ismcagdas that gets me one step further, I think...
The call to bootstrapper.Initialize() seems to start, but then it gets to this Initialize line in this code:
public override void PostInitialize()
{
IocManager.RegisterIfNot<IChatCommunicator, NullChatCommunicator>();
IocManager.Resolve<ChatUserStateWatcher>().Initialize();
IocManager.Resolve<AppTimes>().StartupTime = Clock.Now;
}
Which is in the MySampleProjectCoreModule, and it just bombs out.
Any ideas?
@ismcagdas I have kept that module very simple, as per the example that was given.
It contains the following
[DependsOn(typeof(MySampleApplicationApplicationModule))]
public class MySampleApplicationServiceModule : AbpModule
{
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
}
}
Based on my reading, I "think" the correct way to do this is:
var bootstrapper = new AbpBootstrapper.Create<MySampleProjectApplicationModule>();
bootstrapper.Initialize();
and from there, I could do:
var myService = bootstrapper.IocManager.Resolve<IMyService>();
Is this the correct approach? When I try the above, I get an error message at the Initialize step:
Can't create component 'Abp.BackgroundJobs.BackgroundJobStore' as it has dependencies to be satisfied.
'Abp.BackgroundJobs.BackgroundJobStore' is waiting for the following dependencies:
- Service 'Abp.Domain.Repositories.IRepository`2[[Abp.BackgroundJobs.BackgroundJobInfo, Abp, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
Any ideas on what I need to do to correct this problem?
I have added a reference to the Abp NuGet Package, which I thought was the issue, but looks like it is something else.
Thanks in advance!
Thank you for taking the time to respond.
I am going to give this a try just now. Once I have initialized the bootstrapper as you have suggested, how can I then resolve an instance of a particular service, so use within my Windows Service?
Thanks
Thank you for taking the time to respond.
I am still not sure if I understand...
I have went ahead and created a Module as you suggested, but the PreInitialize and Initialize override methods are never called. In my Windows Service, I don't have the Castle Windsor DI System. Where should I configure the Abp Modules, so that they are initialized within my application?
Thanks
Gary