Base solution for your next web application

Activities of "ddnils"

Answer

In the end I would like to have a "stretch goal" where I can get images through a web-api call like this:

<abpApp>/api/images/<imageIdOrName>?width=200&height=300

this could prove to be very useful if I have to load images in different resolutions for different media types (mobile to desktop). Of course caching should be implemented here... maybe even save different (default) sizes of an image inside db for specially indicated images like background images, logos, etc. (we could specify these images with a selector-attribute).

Answer

This is what I would suggest as FileEntity:

namespace Abp.Application.Services.Dto
{
    /// <summary>
    /// saves files in database
    /// </summary>
    /// <typeparam name="TPrimaryKey"></typeparam>
    [Serializable]
    public class FileEntityDtoOfTPrimaryKey<TPrimaryKey>: IEntityDto<TPrimaryKey>
    {
        /// <summary>
        /// Id of the entity.
        /// </summary>
        public TPrimaryKey Id { get; set; }
        /// <summary>
        /// This holds the bytearray contents of the file
        /// </summary>
        public Byte[] FileContent { get; set; }
        /// <summary>
        /// holds the size of the file in bytes
        /// </summary>
        public int FileSize { get; set; }
        /// <summary>
        /// holds the filename (without extension) 
        /// </summary>
        public string FileName { get; set; }
        /// <summary>
        /// holds the extension or filetype
        /// </summary>
        public string FileExtension { get; set; }

        /// <summary>
        /// 
        /// </summary>
        protected FileEntityDtoOfTPrimaryKey()
        {
            if (this.FileContent != null)
            {
                this.FileSize = FileContent.Length;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        protected FileEntityDtoOfTPrimaryKey(TPrimaryKey id)
        {
            this.Id = id;
            if (this.FileContent != null)
            {
                this.FileSize = FileContent.Length;
            }
        }
    }
}

have you tried changing

<html lang="en">

to

<html lang="fa-ir">

(in _Layout.cshtml)

  • This should set your primary language.

+1

There are still some un-translated ui-exceptions in CreateExceptionForFailedLoginAttempt (AccountController), did you check that?

You might want to move this question to stackoverflow - there are already a lot of answers there: <a class="postlink" href="http://stackoverflow.com/questions/18571001/file-upload-using-angularjs">http://stackoverflow.com/questions/1857 ... -angularjs</a>

Hello Vitor, I would recommend you to use Azure on one App, it pretty much scales itself. - You usually don't need to split it.

I do use continuous integration with VS Online (took me about 1h to set up). One of the best features is, that it does all the testing before it provisions to azure web. - So if you use testing, this is a good option for you. But it has it's merits too. I once tried to publish a website with visual studio which was at the same time connected via continuous integration. This went horribly wrong and I worked for hours to get back a working version.

So my recommendation is to use continuous integration, if you do test a lot. (If you use a msdn subscription for the licensing be aware of the 5 builds per day limit). If not, you can use VS to publish to azure, it's easier to maintain.

Have a look at Entity Framework.

You can pretty much use either. If you just want Many to Many relationship, thats possible by just creating your Entities the right way:

public class Article: Entity<long> {
  public  long Id {get;set;}
  ...
  public virtual ICollection<Tag> Tags {get;set;}
}

public class Tag: Entity<long> {
  ...
  public virtual ICollection<Article> Articles {get;set;}
}

This should work. (EF creates your tables)

But if you want your relationship table to have additional fields (ie. CreationDate) you need to use FluentApi.

See this document for help: <a class="postlink" href="http://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx">http://www.entityframeworktutorial.net/ ... first.aspx</a>

Have you considered using

    private readonly UserManager _userManager;

in your Controller (use DI to get the actual Manager)?

this should give you: _userManager.GetUserByIdAsync()

Answer

So it seems I did misunderstand Permissions persistence.

I thought the permissions created through AuthorizationProvider.SetPermissions would be persisted inside AbpPermissions. But it seems they have to be created inside my AuthorizationProvider. For me that's a little strange. Why don't you persist the Names and Localisations to the Database (i.e. AbpPermissionNames)?

Also the error handling for the navigation menu (NavigationProvider) feels awkward. GetScripts fails completely when the Permission cannot be found. Would you mind, if I change this in Github? Or open an Issue on this?

Showing 1 to 10 of 20 entries