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

Activities of "andmattia"

Question

Hi,

after the update of my solution to v7.1.0 for ASP.NET MVC 5.x & Angularjs 1.x .NET Framework 4.6.1 I've this expection in Mapper.Map(,)

System.InvalidOperationException: Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance. at AutoMapper.Mapper.get_Instance() at AutoMapper.Mapper.Map[TSource,TDestination](TSource source, TDestination destination) at redo.Procedures.ProcedureAppService.<UpdateProcedureAsync>d__45.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at redo.Procedures.ProcedureAppService.<CreateOrUpdateProcedure>d__37.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51...`

I'm missing somethings?

Hi

after upgrade from 4.2.0 to 4.8.1 I have an error on startup and I need to comment this row on web.config I need to do more action?

<modules runAllManagedModulesForAllRequests="true">
      <!--<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />-->
    </modules>
Question

Can you confirm that the History is enable only on .Net EF Core?

I check the compare map and I don't find anything about that?

Mattia

I've create a new module for exporting and I make my module dependent from it with DependOn attribute and it work as aspected but the Ioc not inject the ILogger.

Below some part of my code. So If I don't call the Initialize() on creator ILogger still remain to NullLogger and the Initialize() never call from Ioc What I'm wrong?

public abstract class EpPlusExcelExporterBase<T> : ITransientDependency, IDisposable, IShouldInitialize
{
...
        public ILocalizationManager LocalizationManager { get; set; }
        public ILogger Logger { get; set; }
        ....
        
        protected EpPlusExcelExporterBase()
        {
            AppFolders = NullAppFolder.Instance;
            Logger = NullLogger.Instance;
            LocalizationManager = NullLocalizationManager.Instance;

        }

        protected EpPlusExcelExporterBase(string localizationName)
        : this()
        {
            LocalizationSourceName = localizationName;
            Initialize();
        }
        
         public virtual void Save(ExcelPackage excelPackage, FileDto file)
        {
            
            var filePath = Path.Combine(AppFolders.TempFileDownloadFolder, file.FileToken);
            excelPackage.SaveAs(new FileInfo(filePath));

        }
        
        public void Initialize()
        {
            AppFolders = IocManager.Instance.IocContainer.Resolve<IAppFolders>();
            Logger = IocManager.Instance.IocContainer.Resolve<ILogger>();
            LocalizationManager = IocManager.Instance.IocContainer.Resolve<ILocalizationManager>();
        }
}

I've a problem on a shared DLL on ABP .Net 4.x not core.

I've create a shared DLL where I put some Interface/implementation like

MyControllerApplicationService : IApplicationService

So If I move this class from ApplicationModule MyControllerApplicationService is not registered and I don't see on js and Ioc to restore the normal functionality I need to move back to Application module.

Is there a way to solve this issue?

Is it possibile add HTML code in a user notfication (es. a link to download a file)?

we are moving to TypeScript all our solution and after some test we have some open issue. I try NSwag to generate the AnguarlJS proxy but our solution has a lot of method and in some module the signature is duplicate. Since now Swagger work well and any module can ruoute the correct path but Nswag not works fine, so I try to use

/api/TypeScript?isCompleteService=true

But I have another issue AppService in some case are not able to solve AppService name and collision of Object name (es. HolidayAppService i get method to get list my complex object contain base class Holiday (came from .Core module) and the proxy class has to export class Holiday) For this issue we evaluate a refator to move all method from raw objet to Dto.

But the big issue right now is an error on .ts file generate on both (abp proxy or nSwag)

export class customAttributeData {
        attributeType: type;
        constructor : constructorInfo;
        constructorArguments: iListOfCustomAttributeTypedArgument;
        namedArguments: iListOfCustomAttributeNamedArgument;
    }

this class has an attribute named constructur but it's a reserved words so I need to change my TS file to rename this property.

Anyone has the same issue. This happen using abp or using NSwag

Question

I try to implement my custom Session to store some information (es. companyId) I use this code

 public interface IMySession : ITransientDependency
    {
        long CompanyId { get; set; }
        void SetCompanyId(long companyId);
    }

    public class NullableMySession : IMySession
    {
        private static readonly NullablemySession SingletonInstance = new NullableMySession();

        public static NullableMySession Instance
        {
            get { return NullableMySession.SingletonInstance; }
        }

        public long CompanyId { get; set; }
        public void SetCompanyId(long companyId)
        {
            
        }
    }
    
    public class MySession : IMySession
    {
        public long CompanyId
        {
            get;
            set;
            //get
            //{
            //    var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;
            //    if (claimsPrincipal == null)
            //    {
            //        return 0;
            //    }

            //    var company = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == myConsts.SessionCompany);
            //    if (company == null || string.IsNullOrEmpty(company.Value))
            //    {
            //        return 0;
            //    }

            //    return System.Convert.ToInt32(company.Value);
            //}
        }

        public void SetCompanyId(long companyId)
        {
            var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;
            var claimsIdentity= Thread.CurrentPrincipal.Identity as ClaimsIdentity;
            
            var company = claimsPrincipal.Claims.FirstOrDefault(c=> c.Type == myConsts.SessionCompany);
            if (company != null)
            {
                claimsIdentity.RemoveClaim(company);
                
            }
            claimsIdentity.AddClaim(new Claim(myConsts.SessionCompany, companyId.ToString()));
        }
    }

If I try to set value after login on Principal the new value is not persisted on Principal, so I move to simple solution store on session. I add a

        public IMySession MySession { get; set; }

        protected demoAppServiceBase()
        {
            LocalizationSourceName = clayConsts.LocalizationSourceName;
            MySession = NullableMySession.Instance;
        }

But Any time to redo a call from API the value is not persisted on mySession so I add the row on coreModule preInitialize

IocManager.IocContainer.Register(Component.For<IMySession, MySession>().ImplementedBy<MySession>());

After do that the value is persistend on all call, but is it the correct way or I make some mistakes?

Mattia

about this article Articles/How To/add custom data filter ef core is possibile to do the same on MVC abp (Abp version 4.2)?

I have a multiple instance of IReportData so I register it on PreInitialize of my module

IocManager.IocContainer.Register(
                Component.For<IReportData, Expense>().ImplementedBy<Expense>(),
                Component.For<IReportData, Invoice>().ImplementedBy<Invoice>()
                );

In this way I need to register every new IReportData, how can I do it automatically via IocManager.IocContainer?

Showing 31 to 40 of 64 entries