Base solution for your next web application

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

Hi! I'm trying to run ABP services from a console application.

I was guided by this example [https://support.aspnetzero.com/QA/Questions/9031/Accessing--DomainService-Repositories-from-outside-Web-Solution] (https://support.aspnetzero.com/QA/Questions/9031/Accessing--DomainService-Repositories-from-outside-Web-Solution), specifically using the example https://github.com/aspnetboilerplate/aspnetboilerplate-samples/blob/master/AbpEfConsoleApp/AbpEfConsoleApp/Program.cs, but I can't get it to work.

When I run it I get the following error: (VCloud is the name of my app)

> Castle.MicroKernel.Handlers.HandlerException
HResult=0x80131500
Message=Can't create component 'VCloud.VCloudCustom.Common.VCloudSettingProvider' as it has dependencies to be satisfied.
'VCloud.VCloudCustom.Common.VCloudSettingProvider' is waiting for the following dependencies:
Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Configuration.Setting, Abp.Zero.Common, 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.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(Type service)
at Abp.Dependency.IocManager.Resolve(Type type)
at Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver, Type type)
at Abp.Configuration.SettingDefinitionManager.Initialize()
at Abp.AbpKernelModule.PostInitialize()
at Abp.Modules.AbpModuleManager.<>c.b__15_2(AbpModuleInfo module)
at System.Collections.Generic.List1.ForEach(Action1 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 27

This exception was originally thrown at this call stack:

ConsoleTesting.Program.Main(string[]) in Program.cs

This is my code of the console app what im trying to do:

> using System;
using System;

using Abp;
using Abp.Dependency;
using Abp.Castle.Logging.Log4Net;

using Castle.Facilities.Logging;
using VCloud;
using VCloud.Rtdm.CashAudit;

namespace ConsoleTesting
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starting");
 //Bootstrapping ABP system
        //using (var bootstrapper = AbpBootstrapper.Create<MyConsoleAppModule>())
        using (var bootstrapper = AbpBootstrapper.Create<VCloudApplicationModule>())
        {
            bootstrapper.IocManager
                .IocContainer
                .AddFacility<LoggingFacility>(f => f.UseAbpLog4Net().WithConfig("log4net.config"));
            bootstrapper.Initialize();

            //Getting a Tester object from DI and running it
            using (var tester = bootstrapper.IocManager.ResolveAsDisposable<RtdmCashAuditService>())
            {
                var r = tester.Object.Test();
                Console.WriteLine(r);
            } //Disposes tester and all it's dependencies

            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();
        }
    }
}
>
> 
> }

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

For some reason that I can't understand, I can't get him to take the language change.

It's like I'm not reading the language's XML. I even stepped on the English file with the Spanish ones and didn't change any text.

Testing the configuration I see that when I try the source = "AbpZero" texts appear, but when I change the name of my project (VCloud) nothing appears. As if I wasn't finding the XML.

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

Hi! AspNetZero 8.4 .Net Core Angular.

I have correctly configured the multitenant and access correctly via tenant1.mydomain.com and tenant2.mydomain.com. But now I don't know how to access the host site (the site that manages the tenants)

regards!

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!

Showing 1 to 10 of 24 entries