Base solution for your next web application

Activities of "ddnils"

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>

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

+1

have you tried changing

<html lang="en">

to

<html lang="fa-ir">

(in _Layout.cshtml)

  • This should set your primary language.
Question

Hi there, I would like to post a feature request. What do you think about a File-Storage in database? I would like to propose file storage (pdf, jpeg, jpg, etc.) in database with a new Entity class (FileEntity). It should save files in database as bytearrays. For additional properties I propose fileSize and fileType or fileExtension. The FileEntity should be served by a webapi and have overloads for images (possibly for different resolutions).

I will try to implement a demo of this in the coming weeks and come back, but what do you think?

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;
            }
        }
    }
}
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).

I would like to know how I may go on to measure/count WebApi calls from my clients.

My plan is to get some data on how often my different WebApi-Endpoints are visited and possibly by whom.

Say I have a people WebApi - /person/id and beyond that /person/address and /person/pets I would like to know how frequent these APIs are visited by those who use my WebApi. One of my "clients" is a mobile App, and possibly I will be getting more clients. I even consider giving them keys (like google is doing). So I would count Api-Calls per client-key.

Any ideas on the matter would be most appreciated.

Showing 21 to 28 of 28 entries