Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "unidata"

Thanks for your answer!

Make the changes you mention and get it to move forward in the execution and now I get another error, always within the so-called

bootstrapper.Initialize();
Can't create component 'Abp.BackgroundJobs.BackgroundJobStore' as it has dependencies to be satisfied.

Is there any way I can avoid trying to set up the Backgroudjob? Try this setting and it gives me the error I indicate.

Configuration.BackgroundJobs.IsJobExecutionEnabled = false;

This is the complete exception

Castle.MicroKernel.Handlers.HandlerException
  HResult=0x80131500
  Message=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=5.4.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' which was not registered.

  Source=Castle.Windsor
  StackTrace:
   at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)
   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernel(CreationContext context, ComponentModel model, DependencyModel dependency)
   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
   at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)
   at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments)
   at Castle.Windsor.WindsorContainer.Resolve[T]()
   at Abp.Dependency.IocManager.Resolve[T]()
   at Abp.AbpKernelModule.PostInitialize()
   at Abp.Modules.AbpModuleManager.<>c.b__15_2(AbpModuleInfo module)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Abp.Modules.AbpModuleManager.StartModules()
   at Abp.AbpBootstrapper.Initialize()
   at ConsoleTesting.Program.Main(String[] args) in D:\Source\Vinson\VCloud\ConsoleTesting\Program.cs:line 25

  This exception was originally thrown at this call stack:
    [External Code]
    ConsoleTesting.Program.Main(string[]) in Program.cs

I resolve the problem. I was moved the folder into another folder and had stopped matching the rootNameSpace, so, the xml never was loaded.

It worked perfectly with www.mydomain.com Thank you!

228/5000

I already managed to solve it!

To my example code I simply modify the constructor to create an IDapperRepository of an entity that already exists in the database

private readonly IDapperRepository<RtdmOrder> _dapperRepo;
public ReportsManager( IDapperRepository<RtdmOrder>  dapperRepo)
{
   _dapperRepo = dapperRepo;
}

and only change to the DTO type when I run the query.

var query = _dapperRepo.Query<GenericNameQuantityDto>(sqlQuery, new { restaurantId = restaurantId });
Thanks so much for all the help and patience!
  1. You says "GenericNameQuantityDto should not inherit Entity.": If i not inherit class from Entity, the proyect dosen't compile. This line gives error:

Error CS0311 The type 'VCloud.VCloudCustom.Reports.GenericNameQuantityDto' cannot be used as type parameter 'TEntity' in the generic type or method 'IDapperRepository'.

There is no implicit reference conversion from 'VCloud.VCloudCustom.Reports.GenericNameQuantityDto' to 'Abp.Domain.Entities.IEntity'. VCloud.Core D:\Source\Vinson\VCloud\VCloud-ws\src\VCloud.Core\VCloudCustom\Reports\ReportsManager.cs <br>

  private readonly IDapperRepository<GenericNameQuantityDto> _dapperRepo;

The only way i found to compile is to make it inherit from Entity.

Could you please correct in my sample code the correct way to do it? :

 private readonly IDapperRepository<GenericNameQuantityDto> _dapperRepo;
 
public ReportsManager(IDapperRepository<GenericNameQuantityDto> dapperRepo)
        {
             _dapperRepo = dapperRepo;
        }
        
private readonly IDapperRepository<GenericNameQuantityDto> _dapperRepo;

        public ReportsManager( IDapperRepository<GenericNameQuantityDto> dapperRepo)
        {
            _dapperRepo = dapperRepo;
        }

         public Task<List<GenericNameQuantityDto>> GetSalesByGroupRtdmAsync()
         {
                     int restaurantId = 13;
                     var sqlQuery = @"SELECT article_name as Name, sum(quantity) as Quantity, 
                               sum(quantity * unit_price) as Value 
                            FROM rtdm_orderitem  OI JOIN rtdm_order O ON OI.order_id = O.id 
                            WHERE O.restaurant_id = @restaurantId
                            GROUP BY article_name 
                            ORDER BY 2 desc
                            LIMIT 10 ";

            var query = _dapperRepo.Query(sqlQuery, new { restaurantId = restaurantId });
         }
    public class GenericNameQuantityDto : Entity
    {
        public string Name { get; set; }
        public decimal Quantity { get; set; }
        public decimal Percentage { get; set; }
    }

I understand, I managed to make it work using an IDapperRepository in this way: <br>

        private readonly IDapperRepository<GenericNameQuantityDto> _dapperRepo;

        public ReportsManager( IDapperRepository<GenericNameQuantityDto> dapperRepo)
        {
            _dapperRepo = dapperRepo;
        }

         public Task<List<GenericNameQuantityDto>> GetSalesByGroupRtdmAsync()
         {
                     int restaurantId = 13;
                     var sqlQuery = @"SELECT article_name as Name, sum(quantity) as Quantity, 
                               sum(quantity * unit_price) as Value 
                            FROM rtdm_orderitem  OI JOIN rtdm_order O ON OI.order_id = O.id 
                            WHERE O.restaurant_id = @restaurantId
                            GROUP BY article_name 
                            ORDER BY 2 desc
                            LIMIT 10 ";

            var query = _dapperRepo.Query(sqlQuery, new { restaurantId = restaurantId });
         }

Only one last detail is missing, how can I register in the depency injector the class GenericNameQuantityDto ? <br>

    public class GenericNameQuantityDto : Entity
    {
        public string Name { get; set; }
        public decimal Quantity { get; set; }
        public decimal Percentage { get; set; }
    }

I managed to do it this way, which I think is more neat.

   var connectionString2 = (new DefaultAppConfigurationAccessor()).Configuration.GetConnectionString("Default");

If there's a better one, I'll ask you to tell me, otherwise I'll close the question.

Thank you very much for the answers!

hanks for your answer! That's what I had done and I know it works. In order to create the connection I'm reading the connectionstring like this:

var connectionString = ((JObject)(JObject.Parse(File.ReadAllText("appsettings.json")))["ConnectionStrings"]).Property("Default").Value.ToString();

Is there a better way that doesn't involve having to constantly read the appsettings file?

I tried with ConfigurationManager but I can't get it to work

Thank you!

After many tests, regenerating the project, for some reason that I cannot determine, is already working correctly.

Very strange since there were no changes in sources files or configuration, just recompile several times.

Just for the record: I recreate the project with the same name and now its apears to download with core 3.0. regards!

Showing 1 to 10 of 15 entries