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

Activities of "Ricavir"

Hi,

I have implemented a kind of addressbook as you've described in your "step by step" document for ASP.NET CORE + ANGULAR.

My problem is that when I remove child entities, let's say removing a phone entities from Person entity, they are still available after querying the database. This is because of SoftDelete. I read that it is an EF limitation and filters aren't applied to included entities...

Do you have the same result with your phonebook example project ?

Hi,

I published my app (asp.net core + angular) on my IIS server. I added my domain url to WebHostBuilder :

namespace ELEVEN_SOFT.Logisav.Web.Startup
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .UseUrls("https:////mydomainname.com")
                .Build();

            host.Run();
        }
    }
}

Everything seems to work properly when testing the app. But on my log file, I have several exceptions linkked with identity server :

INFO  2017-08-12 10:58:37,432 [17   ] entication.JwtBearer.JwtBearerMiddleware - Successfully validated the token.
INFO  2017-08-12 10:58:37,432 [17   ] entication.JwtBearer.JwtBearerMiddleware - HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer.
INFO  2017-08-12 10:58:37,432 [17   ] entication.JwtBearer.JwtBearerMiddleware - Failed to validate the token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0IiwibmFtZSI6ImFkbWluIiwiQXNwTmV0LklkZW50aXR5LlNlY3VyaXR5U3RhbXAiOiI5MDc2MWU3MS00MTA5LTQ2ODktOGQzZS0wNDNhMWZhZmIzNTUiLCJyb2xlIjoiQWRtaW4iLCJodHRwOi8vd3d3LmFzcG5ldGJvaWxlcnBsYXRlLmNvbS9pZGVudGl0eS9jbGFpbXMvdGVuYW50SWQiOiIzIiwianRpIjoiYmY3MTc5NmYtMmUyMC00OTBiLTlhNTYtNjUxMzhlZGZkMjJjIiwiaWF0IjoxNTAyNTI0NDAwLCJuYmYiOjE1MDI1MjQ0MDAsImV4cCI6MTUwMjYxMDgwMCwiaXNzIjoiTG9naXNhdiIsImF1ZCI6IkxvZ2lzYXYifQ.KjUfCsnw3muqoIjWw3i7YkN6yK48gQsAapJeMzasp2Y.
Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException: IDX10503: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId: 3c0acb9ccff2fa42456b471e8b8bc919
'.
Exceptions caught:
 ''.
token: '{"alg":"HS256","typ":"JWT"}.{"sub":"4","name":"admin","AspNet.Identity.SecurityStamp":"90761e71-4109-4689-8d3e-043a1fafb355","role":"Admin","http://www.aspnetboilerplate.com/identity/claims/tenantId":"3","jti":"bf71796f-2e20-490b-9a56-65138edfd22c","iat":1502524400,"nbf":1502524400,"exp":1502610800,"iss":"Logisav","aud":"Logisav"}'.
   à System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
   à System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
   à Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.<HandleAuthenticateAsync>d__1.MoveNext()
INFO  2017-08-12 10:58:37,432 [17   ] entication.JwtBearer.JwtBearerMiddleware - Bearer was not authenticated. Failure message: IDX10503: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId: 3c0acb9ccff2fa42456b471e8b8bc919
'.
Exceptions caught:
 ''.
token: '{"alg":"HS256","typ":"JWT"}.{"sub":"4","name":"admin","AspNet.Identity.SecurityStamp":"90761e71-4109-4689-8d3e-043a1fafb355","role":"Admin","http://www.aspnetboilerplate.com/identity/claims/tenantId":"3","jti":"bf71796f-2e20-490b-9a56-65138edfd22c","iat":1502524400,"nbf":1502524400,"exp":1502610800,"iss":"Logisav","aud":"Logisav"}'.

I tried to remove "openid" settings from appsettings.json but still same exceptions.

I think it is due to an incorrect identityserver settings but don't how to correct it. On the log exception, it is also mentioned the url <a class="postlink" href="http://www.aspnetboilerplate.com/identity/claims/tenantId">http://www.aspnetboilerplate.com/identi ... s/tenantId</a> which should not be here actualy.

Can you guide me to fix this ?

Hi,

I've been trying to publish my project aspnetzero 4.2.1 (aspnet core + angular + merged solution). I want to publish to IIS. Angular build is working.

When publish process is ending, I had a lot of errors (more than 800) because of file missing ; in fact, it was because angular output dir was not setted as it was excepted... I changed it to wwwroot (instead of wwwroot/dist)

Now, I have 13 errors still because of file missing :

\wwwroot\swagger\ui\index.html can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-07.jpg can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-10.jpg can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-09.jpg can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-05.jpg can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-06.jpg can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-02.jpg can not be found Web.Host\wwwroot\Common\Images\logo.png can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-04.jpg can not be found Web.Host\wwwroot\Common\Images\SampleProfilePics\sample-profile-03.jpg can not be found

Do you know why I'm having these issues ?

Question

Hi support team,

I would like to change list page size according to some custom settings and depending on appservice call. Ex : appservice1 sends its result with a page size of 15 items by default appservice2 sends its result with a page size of 50 items by default

On server side, I see that DefaultPageSize is set to 10 (on AppConsts.cs). On client side (angular project), the value can be changed by user and stored within the browser ; so that, if user opens again a previous page, its list sized in setted to its previous value (different from 10).

What would you recommend to be able to change DefaultPageSize value according to appservice ?

Hello support,

I have following issue :

I have added a collection to User entity like this :

/// <summary>
    /// Represents a user in the system.
    /// </summary>
    public class User : AbpUser<User>
    {
        public const int MinPlainPasswordLength = 6;

        public const int MaxPhoneNumberLength = 24;

        public virtual Guid? ProfilePictureId { get; set; }

        public virtual bool ShouldChangePasswordOnNextLogin { get; set; }

       <span style="color:#FFFF00">public virtual ICollection<Event> Events { get; set; } </span>

As you can see, a collection of Event entities is added.

I also added a collection of User entity in Event entity like this :

[Table("LsEvents")]
    public class Event : FullAuditedEntity<long>, IMustHaveTenant
    {
        public virtual int TenantId { get; set; }

        [ForeignKey("AddressId")]
        public virtual Address Address { get; set; }
        public virtual long AddressId { get; set; }

        [Required]
        public virtual DateTime Begin { get; set; }

        [Required]
        public virtual DateTime End { get; set; }

        public virtual string Description { get; set; }

        public virtual ICollection<User> EventUsers { get; set; }

I've run the migrations on the database and everything went as excepted : foreign keys added to both table AbpUsers and LsEvents and an additional table UserEvents has been added automaticaly to manage many-to-many relationship.

Now, looking to the Event application service : I've created my DTO's to get, create and update Events. I am able to add a new event object with some Abp users as collection. No problem with this.

The problem is to update existing Event entities... When my Event DTO is received, the mapping is working well but User properties are being validated and following error is trhrown :

ERROR 2017-08-04 15:03:12,810 [8 ] EntityFramework.DbContext - There are some validation errors while saving changes in EntityFramework: ERROR 2017-08-04 15:03:12,810 [8 ] EntityFramework.DbContext - - Password: Le champ Password est requis.

Actually, I just want to update the link between Event and Users ... and not update each User entity !

Can you please provide a solution for that ?

Hello support,

I have following issue :

I have added a collection to User entity like this :

/// <summary>
    /// Represents a user in the system.
    /// </summary>
    public class User : AbpUser<User>
    {
        public const int MinPlainPasswordLength = 6;

        public const int MaxPhoneNumberLength = 24;

        public virtual Guid? ProfilePictureId { get; set; }

        public virtual bool ShouldChangePasswordOnNextLogin { get; set; }

       <span style="color:#FFFF00">public virtual ICollection<Event> Events { get; set; } </span>

As you can see, a collection of Event entities is added.

I also added a collection of User entity in Event entity like this :

[Table("LsEvents")]
    public class Event : FullAuditedEntity<long>, IMustHaveTenant
    {
        public virtual int TenantId { get; set; }

        [ForeignKey("AddressId")]
        public virtual Address Address { get; set; }
        public virtual long AddressId { get; set; }

        [Required]
        public virtual DateTime Begin { get; set; }

        [Required]
        public virtual DateTime End { get; set; }

        public virtual string Description { get; set; }

        public virtual ICollection<User> EventUsers { get; set; }

I've run the migrations on the database and everything went as excepted : foreign keys added to both table AbpUsers and LsEvents and an additional table UserEvents has been added automaticaly to manage many-to-many relationship.

Now, looking to the Event application service : I've created my DTO's to get, create and update Events. I am able to add a new event object with some Abp users as collection. No problem with this.

The problem is to update existing Event entities... When my Event DTO is received, the mapping is working well but User properties are being validated and following error is trhrown :

ERROR 2017-08-04 15:03:12,810 [8 ] EntityFramework.DbContext - There are some validation errors while saving changes in EntityFramework: ERROR 2017-08-04 15:03:12,810 [8 ] EntityFramework.DbContext - - Password: Le champ Password est requis.

Actually, I just want to update the link between Event and Users ... and not update each User entity !

Can you please provide a solution for that ?

Hi,

I'm doing an ApplicationService. I would like to validate a DTO input according to some application settings. To do so, I implement ICustomValidate on my DTO class but I'm not able to get my setting value with SettingManager.GetSettingValueAsync...

Do you know how to proceed ?

If not possible, I could do a data validation directly on the ApplicationService before inserting data on the database... what is your advice ?

Thanks

Hi,

I wanted to use the localization method inside my HTML template within an input object (angular2 project) . But, writing into placeholder property is not working : placeholder={{l("SomeID")}}

Any reason for that ?

Hi,

I have an issue when trying to update a collection inside an Entity. My entities are :

Address entity :

[Table("LsAddresses")]
    public class Address : FullAuditedEntity<long>, IMustHaveTenant
    {               
        public virtual int TenantId { get; set; }

        [Required]
        [MaxLength(ConstForLength.Name)]
        public virtual string Name { get; set; }
        
        [MaxLength(ConstForLength.DescriptionTitle)]
        public virtual string Title { get; set; }        

        public virtual ICollection<PhoneAddress> Phones { get; set; }
    }

PhoneAddress entity :

[Table("LsPhonesAddress")]
    public class PhoneAddress : FullAuditedEntity<long>
    {
        [ForeignKey("AddressId")]
        public virtual Address Address { get; set; }
        public virtual long AddressId { get; set; }

        [Required]
        [MaxLength(ConstForLength.Number)]
        public virtual string Number { get; set; }
    }

I have created an interface with following DTO

[AutoMap(typeof(Address))]
    public class AddressEditDto : EntityDto<long>
    {
        [Required]
        [MaxLength(ConstForLength.Name)]
        public string Name { get; set; }

        [MaxLength(ConstForLength.DescriptionTitle)]
        public string Title { get; set; }
       
        public Collection<PhoneAddressInAddressListDto> Phones { get; set; }
    }

  [AutoMap(typeof(PhoneAddress))]
    public class PhoneAddressInAddressListDto
    {       
        public string Number { get; set; }
    }

And my application service :

[AbpAuthorize(AppPermissions.Pages_Tenant_Addresses_Create)]
        public async Task CreateAddress(AddressEditDto input)
        {
            var address = input.MapTo<Address>();
            await _addressRepository.InsertAsync(address);
            
        }

        [AbpAuthorize(AppPermissions.Pages_Tenant_Addresses_Edit)]
        public async Task<AddressEditDto> GetAddressEdit(EntityDto<long> input)
        {
            var address = await _addressRepository.GetAsync(input.Id);
            return address.MapTo<AddressEditDto>();
        }

        [AbpAuthorize(AppPermissions.Pages_Tenant_Addresses_Edit)]
        public async Task UpdateAddressEdit(AddressEditDto input)
        {
            var address = await _addressRepository.GetAsync(input.Id);
            input.MapTo(address);
            await _addressRepository.UpdateAsync(address);            
        }

In angular2 side, I'm able to create and get address entities with phones. But when I try to update an Address entity with a phone collection, I have foreign key exception on server side. Here is the exception from log :

System.InvalidOperationException: The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted. à System.Data.Entity.Core.Objects.ObjectContext.PrepareToSaveChanges(SaveOptions options) à System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesInternalAsync>d__31.MoveNext()

I could remove collection from the DTO and have separated updates but I would like to fin a clean way to update collection inside an entity for other cases.

Any help is welcome ;)

Hello,

When I open a popup message to the user, the buttons of the popup are not translated. The buttons are always "Cancel" and "Yes" in all available languages.

Screenshot attached.

I don't see any attribute to be passed on MessageService class.

How can I fix that ?

Cheers

Showing 81 to 90 of 93 entries