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

Activities of "behiunforgiven"

In WPF Sample there is only one form. How can I create another form and use dependency injection ?

for example:

private readonly IPersonAppService _personAppService;

        public MainForm(IPersonAppService personAppService)
        {
            _personAppService = personAppService;
            InitializeComponent();
        }

how can I create a new MainForm(and showdialog) ?

Wow I,m sorry for this mistake !!!

I inject two classes into each other!

that causes ERROR !

This is Error body

{"message":"An error has occurred.","exceptionMessage":"ComponentActivator: could not proxy Abp.WebApi.Controllers.Dynamic.DynamicApiController`1[[IAU.Quantities.Faculty.IFacultyAppService, IAU.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]","exceptionType":"Castle.MicroKernel.ComponentActivator.ComponentActivatorException","stackTrace":"   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)\r\n   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)\r\n   at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)\r\n   at Castle.Windsor.WindsorContainer.Resolve(Type service)\r\n   at Abp.Dependency.IocManager.Resolve(Type type)\r\n   at Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver, Type type)\r\n   at Abp.WebApi.Controllers.AbpApiControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\r\n   at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()","innerException":{"message":"An error has occurred.","exceptionMessage":"Dependency cycle has been detected when trying to resolve component 'IAU.Quantities.Faculty.FacultyAppService'.\r\nThe resolution tree that resulted in the cycle is the following:\r\nComponent 'IAU.Quantities.Faculty.FacultyAppService' resolved as dependency of\r\n\tcomponent 'IAU.Quantities.Totals.TotalAppService' resolved as dependency of\r\n\tcomponent 'IAU.Quantities.Faculty.FacultyAppService' resolved as dependency of\r\n\tcomponent 'Abp.WebApi.Controllers.Dynamic.Interceptors.AbpDynamicApiControllerInterceptor`1[[IAU.Quantities.Faculty.IFacultyAppService, IAU.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' resolved as dependency of\r\n\tcomponent 'Abp.WebApi.Controllers.Dynamic.DynamicApiController`1[[IAU.Quantities.Faculty.IFacultyAppService, IAU.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which is the root component being resolved.\r\n","exceptionType":"Castle.MicroKernel.CircularDependencyException","stackTrace":"   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernel(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveCore(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernel(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveCore(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernel(CreationContext context, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveCore(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)\r\n   at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)\r\n   at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)\r\n   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)\r\n   at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)\r\n   at Castle.Core.InterceptorReference.Castle.MicroKernel.IReference<Castle.DynamicProxy.IInterceptor>.Resolve(IKernel kernel, CreationContext context)\r\n   at Castle.Windsor.Proxy.AbstractProxyFactory.ObtainInterceptors(IKernel kernel, ComponentModel model, CreationContext context)\r\n   at Castle.Windsor.Proxy.DefaultProxyFactory.Create(IKernel kernel, Object target, ComponentModel model, CreationContext context, Object[] constructorArguments)\r\n   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)"}}

After updating to ABP v0.7.7.1 I have an error in my Application Service I found that when I inject

private readonly ITotalAppService _totalAppService;

error occurs.

it had no errors before.

Question

I Create a new class and derived from "XAppServiceBase", but when I want to use "UserManager" in that class, it is null !

public class GeneralAppService : IAUAppServiceBase
    {
        public string GetStateName(long userId)
        {
            //I want to use UserManage Here but it's null !
        }
    }

I use this code to solve this:

Mapper.CreateMap<RegisterRequest, RegisterRequestOutDto>()
                .ForMember(dest => dest.UnitName, opt =>
                    opt.MapFrom(src => src.Unit.UnitName))

Did you try $rootScope ?

Thanx for your answer but, No, it doesn't work

I Can add "UnitName" to My DTO by and fill it by a foreach loop.

But I want to use AutoMapper.

Question

How Can I Create a DTO from these classes :

public class RegisterRequest : Entity
    {
        public int? UnitId { get; set; }
       .
       .
       .
       .
       public virtual Unit Unit { get; set; }
    }

and

public class Unit : Entity
    {
        public Unit()
        {
            RegisterRequests = new HashSet<RegisterRequest>();
        }
       public string UnitName { get; set; }
       .
       .
       .
       public virtual ICollection<RegisterRequest> RegisterRequests { get; set; }
    }

that contains whole "RegisterRequest" class and "UnitName" of "Unit" class.

thank you

Clearing cookies solve my problem but what causes this?

how to prevent it?

Showing 1 to 10 of 33 entries