Base solution for your next web application

Activities of "patrickglaudemans"

Hi,

As matter of fact - it did work (custom errors mode off) but only within fiddler or in browser, not in the logs.

Thanks, with this data I can investigate it further on.

Hi,

No go with custom errors - didn't even try eventlog ;-)

Any other suggestions?

Hi,

When debugging the application and after changing some frontend angular code, the dynamic web api layer gets rebuild. After that - two of my app services are returning 'internal server error' errors from all methods. The log file is empty.

After a complete rebuild of the solution, it's working again.

As for both of the services, the normal pattern is used. I'm using all last libs and Zero code. It's a fresh template.

Fiddler is giving no extra info - how can I debug this?

Regards, P

Hi,

while doing Upgrade to ABP (zero) 0.9.* (multi database tenant support) I ran into the problem that TUser is not recognized. Check below. I already sent Halil a message since this is a breaking issue for us.

I did read the blog: <a class="postlink" href="http://volosoft.com/aspnet-boilerplate-v0-9-and-aspnet-zero-v1-10-have-been-released/">http://volosoft.com/aspnet-boilerplate- ... -released/</a>

enant, Role and User Entities Tenant, Role and User entities are derived from AbpTenant, AbpRole and AbpUser. These base classes are generic classes and their generic parameters are changed:

AbpUser<TTenant, TUser> become AbpUser<TUser> AbpRole<TTenant, TUser> become AbpRole<TUser> AbpTenant<TTenant, TUser> become AbpTenant<TUser> As you see, we removed TTenant parameters since in database per tenant architecture, we can not define navigation properties from tenant users to tenant entity, they may be in different databases.

Hi,

Thanks - thats what I was looking for. Obvious that datafilter are there for retrieving data.

Hi, In the UOW there are some deletes of child objects from report. These deletes should be deleted, not soft deleted.

I should I force to delete these in stead of softdelete?

Hi,

want to disable softdelete at update of a certain entity like:

using (UnitOfWorkManager.Current.DisableFilter(AbpDataFilters.SoftDelete))
            {

                await AddReportChilds(input, report, false);
                await _reportRepository.UpdateAsync(report);
            }

It's not working.

Hi,

This becomes severe. Need to install this onto production.

remember: for one contentgroup: reports are saved properly, users don't..

I hope you can help me out!

You requested for code. Here it is:

entity contentgroup

public class ContentGroup : EntityBase
    {
        public virtual List<Report> Reports { get; set; }
        public virtual List<User> Users { get; set; }
        [MaxLength(LongStringSizeMax)]
        [Required]
        public string Purpose { get; set; }
        //todo: This should be a list containing all site reports admins -> request FO change
        public string DataOwner { get; set; }
        public virtual SiteOffice Site { get; set; }
        
        public int SiteId { get; set; }
    }

entity user (abp, changed)

public class User : AbpUser<Tenant, User>
    {

        public User()
        {
            
        }
        public const int MinPlainPasswordLength = 6;

        public virtual Guid? ProfilePictureId { get; set; }

        public virtual bool ShouldChangePasswordOnNextLogin { get; set; }
        
        /// <summary>
        /// Creates admin <see cref="User"/> for a tenant.
        /// </summary>
        /// <param name="tenantId">Tenant Id</param>
        /// <param name="emailAddress">Email address</param>
        /// <param name="password">Password</param>
        /// <returns>Created <see cref="User"/> object</returns>
        public static User CreateTenantAdminUser(int tenantId, string emailAddress, string password)
        {
            return new User
                   {
                       TenantId = tenantId,
                       UserName = AdminUserName,
                       Name = AdminUserName,
                       Surname = AdminUserName,
                       EmailAddress = emailAddress,
                       Password = new PasswordHasher().HashPassword(password)
                   };
        }

        public static string CreateRandomPassword()
        {
            return Guid.NewGuid().ToString("N").Truncate(16);
        }
        public virtual List<ContentGroup> ContentGroups { get; set; }
    }
}

report entity

public class Report : EntityBase
    {

        public Report()
        {
            MetaDataItems = new EditableList<MetaDataItem>();
            ReportTableCommands = new List<ReportTableCommand>();
            ReportParameters = new List<ReportParameter>();
        }

        public DateTime? Uploaded { get; set; }
        
        public User UploadBy { get; set; }

        public virtual List<ContentGroup> ContentGroups { get; set; }

        [Required]
        public virtual SiteOffice Site { get; set; }
        public int SiteId { get; set; }
        public  List<MetaDataItem> MetaDataItems { get; set; }
        public virtual List<ReportTableCommand> ReportTableCommands { get; set; }
        public virtual List<ReportParameter> ReportParameters { get; set; }

        [MaxLength(MidStringSizeMax)]
        [Required]
        public string ReportApplication { get; set; }

        public ReportApplicationType ReportApplicationType { get; set; }

        public bool Active { get; set; }

        public DateTime? ReportOriginLastModifDate { get; set; }
        public string ReportOriginFileName { get; set; }
        public virtual Guid? ReportBlobId { get; set; }
        

    }

and EF code

public class BIDbContext : AbpZeroDbContext<Tenant, Role, User>
    {
        /* Define an IDbSet for each entity of the application */

        public virtual IDbSet<Report> Reports { get; set; }

        public virtual IDbSet<ContentGroup> ContentGroups { get; set; }
        public virtual IDbSet<BinaryObject> BinaryObjects { get; set; }
        public virtual IDbSet<DataSource> DataSources { get; set; }
        public virtual IDbSet<MetaDataItem> MetaDataItems { get; set; }
        public virtual IDbSet<ReportTableCommand>  ReportTableCommands { get; set; }
        public virtual IDbSet<SiteOffice> Sites { get; set; }
        public virtual IDbSet<ReportParameter> ReportParameters { get; set; }
        public virtual IDbSet<Job> Jobs { get; set; }

        //leave this entity at the end of the list
        public virtual IDbSet<ExtendedAuditLog> ExtendedAuditLogs { get; set; }

        /* Setting "Default" to base class helps us when working migration commands on Package Manager Console.
         * But it may cause problems when working Migrate.exe of EF. ABP works either way.         * 
         */
        public BIDbContext()
            : base("Default")
        {

        }

        /* This constructor is used by ABP to pass connection string defined in BIDataModule.PreInitialize.
         * Notice that, actually you will not directly create an instance of BIDbContext since ABP automatically handles it.
         */
        public BIDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }

        /* This constructor is used in tests to pass a fake/mock connection.
         */
        public BIDbContext(DbConnection dbConnection)
            : base(dbConnection, true)
        {

        }

#if DEBUG

        protected override bool ShouldValidateEntity(DbEntityEntry entityEntry)
        {
            return base.ShouldValidateEntity(entityEntry);
        }


        public override int SaveChanges()
        {
            var result = 0;
            try
            {
                result = base.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                StringBuilder sb = new StringBuilder();

                foreach (var failure in ex.EntityValidationErrors)
                {
                    sb.AppendFormat("{0} failed validation\n", failure.Entry.Entity.GetType());
                    foreach (var error in failure.ValidationErrors)
                    {
                        sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage);
                        sb.AppendLine();
                    }
                }
                var s = sb.ToString();
                throw new DbEntityValidationException(
                    "Entity Validation Failed - errors follow:\n" +
                    sb.ToString(), ex
                ); // Add the original exception as the innerException
            }

            return result;
        }


        public override Task<int> SaveChangesAsync()
        {
            try
            {
                return base.SaveChangesAsync();
            }
            catch (DbEntityValidationException ex)
            {
                StringBuilder sb = new StringBuilder();

                foreach (var failure in ex.EntityValidationErrors)
                {
                    sb.AppendFormat("{0} failed validation\n", failure.Entry.Entity.GetType());
                    foreach (var error in failure.ValidationErrors)
                    {
                        sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage);
                        sb.AppendLine();
                    }
                }

                throw new DbEntityValidationException(
                    "Entity Validation Failed - errors follow (erin gefrot):\n" +
                    sb.ToString(), ex
                ); // Add the original exception as the innerException
            }
        }

#endif
    }

Hi,

Yep.

namespace Intertek.BI.ApplicationService
{
      [DependsOn(
        typeof(BIDataModule), 
        typeof(BIApplicationModule),
        typeof(BIReportingCoreModule)
        )]
    public class ApplicationServiceModule : AbpModule
    {
        public override void PreInitialize()
        {
            //Suppress authentication and permission checking for the console application
            IocManager.Register<IAbpSession, ApplicationServiceSession>();
            IocManager.Register<IPermissionChecker, NullPermissionChecker>();
        }

        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }

}

The error disappeared after having commented out the registration of that particular nul checker in above code! (strange?)

But I fixed it by using log4net directly. It works better that way with Quartz common logging.

Thanks anyway!

Hi,

I'm using setup like mentioned in earlier discussion:

(RE: ACCESSING ZERO APPLICATION LAYER FROM EXTERNAL CLASSLIB #5732 We have a Console Application to demonstrate it: <a class="postlink" href="https://github.com/aspnetzero/aspnet-ze">https://github.com/aspnetzero/aspnet-ze</a> ... ConsoleApp)

When accessing the logger (setup via: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Logging">http://www.aspnetboilerplate.com/Pages/ ... ts/Logging</a>) I get error below: "Could not find a public constructor for type Abp.Authorization.NullPermissionChecker"

detailed error:

Castle.Windsor Warning: 0 : Exception when resolving optional dependency Dependency 'PermissionChecker' type 'Abp.Authorization.IPermissionChecker' on component Intertek.BI.Reporting.Reports.ReportAppService., Castle.MicroKernel.ComponentActivator.ComponentActivatorException: Could not find a public constructor for type Abp.Authorization.NullPermissionChecker.
Windsor by default cannot instantiate types that don't expose public constructors.
To expose the type as a service add public constructor, or use custom component activator.
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)
   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.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.ResolveCore(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
   at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.ObtainPropertyValue(CreationContext context, PropertySet property, IDependencyResolver resolver)
Castle.Windsor Warning: 0 : Exception when resolving optional dependency Dependency 'PermissionChecker' type 'Abp.Authorization.IPermissionChecker' on component Intertek.BI.Reporting.Reports.ReportAppService., Castle.MicroKernel.ComponentActivator.ComponentActivatorException: Could not find a public constructor for type Abp.Authorization.NullPermissionChecker.
Showing 11 to 20 of 47 entries