Base solution for your next web application

Activities of "patrickglaudemans"

Thanks! Let me check again. If it keeps on failing I will sent requested code items.

Hi,

I want to access my ZERO application services from within an external class library (console/win service etc.) Therefore I need to initialize the IocManager like IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); This is only working in a AbpModule. What's the proper way to setup this up.

Thanks, but can you supply proper link - link is broken!

pglaudemans

thanks!

Hi,

Used the Console App (Acm.PhoneBook) as example to setup access from console classlib to zero implementation (application layer etc.)

Created all the proper instances and bootstrapper. Initializing is running well but after calling: var eventProcessor = bootstrapper.IocManager.Resolve<ReportAppService>(); I get this error:

Can't create component 'Intertek.BI.Reporting.Reports.ReportAppService' as it has dependencies to be satisfied.

'Intertek.BI.Reporting.Reports.ReportAppService' is waiting for the following dependencies:

  • Service 'Abp.Domain.Repositories.IRepository`1[[Intertek.BI.Entities.Report, Intertek.BI.Core, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
  • Service 'Abp.Domain.Repositories.IRepository`1[[Intertek.BI.Entities.SiteOffice, Intertek.BI.Core, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
  • Service 'Intertek.BI.Reporting.Core.ReportManager' which was not registered.
  • Service 'Intertek.BI.Storage.DbBinaryObjectManager' which was registered but is also waiting for dependencies. 'Intertek.BI.Storage.DbBinaryObjectManager' is waiting for the following dependencies:
  • Service 'Abp.Domain.Repositories.IRepository`2[[Intertek.BI.Storage.BinaryObject, Intertek.BI.Core, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
  • Service 'Abp.Domain.Repositories.IRepository`1[[Intertek.BI.Entities.DataSource, Intertek.BI.Core, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
  • Service 'Abp.Domain.Repositories.IRepository`1[[Intertek.BI.Entities.ReportTableCommand, Intertek.BI.Core, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

It' seems that DI is not working since registration was not done properly.

Hold it - I solved it. Obviously it had something to do with dependencies to other libraries in the project. To begin with the data layer ;-)

Hi,

I have an entity called Job. It has property (child object) Report (many to one). Each Job has only one report.

While saving the job through a standard ZERO setup (application service with all the standard setup), it's not possible to only save the Id of the report entity while saving only a job. At current, at the moment of update, Job has a populated property Report indeed. When updating it is going through the automated validation of DBContext etc. etc. When there are child properties within the report object (which aren't loaded ofcourse) then the save of the Job entity will fail because of the Report entity! But I don't want to save Report! I want to save Job with only the Report ID (the reference)..

How can I force to only store Job with report Id/reference and not going to store Report entity as well?!

This is partly a EF question but since the DBContext is hidden in the standard JobRepository it's caused by zero setup.

<code> public async Task CreateOrUpdateJob(CreateOrUpdateJobInput input) {

        if (input.Job.Id > 0)
        {
            //existing Job
            var Job = await _JobRepository.GetAsync(input.Job.Id);
            input.Job.MapTo(Job);
            await _JobRepository.UpdateAsync(Job);
        }
        else
        {
            //new Job
            await CreateJobAsync(input);
        }
    }

</code>

Hi,

public class CreateOrUpdateJobInput : IInputDto { [Required] public JobEditDto Job { get; set; } }

[AutoMapFrom(typeof(Job))] [AutoMapTo(typeof(Job))] public class JobEditDto : FullAuditedEntityDto { public Report Report { get; set; } public string CronSchedule { get; set; } public ReportOutputType OutputType { get; set; } public DateTime? LastRun { get; set; } public bool Active { get; set; } public string Destination { get; set; } }

Hi,

Thanks for thinking with me :-) I'm currently testing a procedure with in I added ReportId property to Entity Job (definition in .core) and change the dto property report into reportId.

I'll update in a sec.

Hi,

Way to go! Yes, we should not use entity objects in dto's and yes, you can add the Id of an entity in the definition of an entity like copied below. Then you can set the proper id yourself without the use of instances of the object, in this case report.

Furthermore, set the property Report to virtual when you want it to be lazy loaded!

public class Job : EntityBase
    {
        public int ReportId { get; set; }
        public virtual Report Report { get; set; }
        public string CronSchedule { get; set; }
        public ReportOutputType OutputType { get; set; }
        public DateTime LastRun { get; set; }
        public bool Active { get; set; }
        public string Destination { get; set; }
    }
Showing 11 to 20 of 47 entries