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

Activities of "ddnils"

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.

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?

I have been trying to wrap my mind around the localization features of angular.

Since the razor-views do a lot of the heavy lifting, I am able to localize pretty much every string. My main concern is the localization of dates. When using angular to display dates, I usually do it with a filter like this:

<div>{{scopeValueDate | date: 'shortDate'}}</div>

This works pretty well as expected, but when i activated additional languages I noticed the dates were not localized.

It seems the angular resources for internationalization are not loaded. (/Scripts/i18n/angular-locale_XX.js) They do not appear in Developer Tools / Sources.

Also I am not able to insert them into the page... If I do add a script reference, the script is still not visible in Developer Tools.

Have you experienced anything similar? How do you solve internationalization of dates?

Question

Hi there, i would like to allow anonymous access to my home site. But it seems navigation is dependent on a valid User since it throws me an error saying: No User is logged in.

I have provided HomeController with [AllowAnonymous] Attribute. Any ideas on this matter?

Question

Hi there, i would like to seed permissions into my database. Since there is no IPermissionDefinitionContext available when working with InitialDataBuilder, I do not know how to do that. Do I have to create my own AuthorizationProvider for that? Any advice would be awesome.

I have created a custom repository (i had to, my entity has a combined primary key (long,long)).

public class UserRelation
    {
        public virtual long UserId { get; set; }
        public virtual long FriendId { get; set; }
        [ForeignKey("UserId")]
        public virtual Users.User User { get; set; }
        [ForeignKey("FriendId")]
        public virtual Users.User Friend { get; set; }
        public DateTimeOffset RequestDate { get; set; }
        public DateTimeOffset? AcknowledgeDate { get; set; }
        public FriendRequestStatus FriendStatus { get; set; }
    }

OnModelCreating contains this code to instruct EntityFramework:

modelBuilder.Entity<Entities.UserRelation>().HasKey(f => new { f.UserId, f.FriendId });
            modelBuilder.Entity<Entities.UserRelation>()
              .HasRequired(f => f.User)
              .WithMany()
              .HasForeignKey(f => f.UserId);
            modelBuilder.Entity<Entities.UserRelation>()
                .HasRequired(f => f.Friend)
                .WithMany()
                .HasForeignKey(f => f.FriendId)
                .WillCascadeOnDelete(false);

So I created my custom repository in [].EntityFramework.Repositories Structure:

public class FriendsRepository: EntityFramework.Repositories.IFriendsRepository {}
interface IFriendsRepository : IRepository<Entities.UserRelation>
    {
        System.Threading.Tasks.Task<bool> ApproveFriendshipAsync(long UserId, long FriendId);
        System.Threading.Tasks.Task<Entities.UserRelation> CreateFriendshipAsync(long UserId, long FriendId);
        System.Linq.IQueryable<Entities.UserRelation> GetAllFriendsOfUserId(long UserId);
        System.Linq.IQueryable<Entities.UserRelation> GetAllRelationsOfUserId(long UserId);
        System.Threading.Tasks.Task<Entities.UserRelation> SetFriendshipStatusAsync(long UserId, long FriendId, Entities.FriendRequestStatus status);
    }

But now I wonder how I can inject it into my service structure, since the entityframework project is not referenced in [].Application?

Have I done something wrong? Or is something still missing? Any help is welcome :)

Question

I installed the nuGet package "ASP.NET WebAPI Route Debugger". It created a new Folder named Areas in .Web and inside Areas a Folder "RouteDebugger" with Components, Conrollers and so on. The documentation of Route Debugger states, that it should be available via /rd on my root page. Unfortunatelly it is not :(

<a class="postlink" href="http://blogs.msdn.com/b/webdev/archive/2013/04/04/debugging-asp-net-web-api-with-route-debugger.aspx">http://blogs.msdn.com/b/webdev/archive/ ... ugger.aspx</a>

Any ideas on how to solve this? I really need to debug my routes, for some unknown reason my put requests dont work.

I am trying to create a nested route for one of my controllers.

I have tried this:

RouteConfig:

routes.MapHttpRoute(
                name: "InhabsApi",
                routeTemplate: "api/rooms/{id}/inhabitants/{inhabid}",
                defaults: new { inhabid = RouteParameter.Optional });

Controller looks like this:

[Abp.WebApi.Authorization.AbpApiAuthorize]
        public IHttpActionResult Get(long id)
        {
            return Ok(_roomService.GetAllInhabs(id));
        }

Unfortunatelly it does not work. I read Attribute Routing could help, but I am not sure if this works with Abp. Any help would be very appreciated :)

Showing 1 to 8 of 8 entries