0 Replies - 2424 Views - Last Post: 29 May 2014 - 01:06 PM

#1 AnalyticLunatic   User is offline

  • D.I.C Lover

Reputation: 239
  • View blog
  • Posts: 1,073
  • Joined: 25-June 12

Is there a way to Annotate ASP.Net Identity Properties? MVC5/EF6

Posted 29 May 2014 - 01:06 PM

I was previously creating a project using MVC4/EF5 and have started a new project (for simplest transition)where I am recreating what I have so far in MVC5/EF6 to, among other things, make use of the ASP.NET Identity.

In my IdentityModels.cs I have added several properties such as [NAME], [POSITION], [LASTVISITDATE], etc. On the IdentityModel.cs properties I have also added Grid.MVC Data Annotations which allow me to quickly and easily display a tabled and paged layout of specific Models properties to a View.

Now, I have all of my old code functioning effectively, but the automatic Asp.NET Identity properties in table AspNetUsers such as [PasswordHash], [SecurityStamp], [TwoFactorEndabled], etc. are also showing up inside my Grid.MVC.

Is there any way for me to give these Identity properties the Grid.MVC annotation of [NotMappedColumn], or will I need to scratch my use of Grid.MVC for something else?

I'd really like to use my Grid.MVC method to display data in my view if at all possible as with a few small annotations on the model I am able to render all the data as I wish with some short coding within the View:

<div class="overflowPrevention">

    @*Images in Columns: https://gridmvc.codeplex.com/discussions/440977*@

    @Html.Grid(Model).Columns(columns =>
        {
            columns.Add().Encoded(false).Sanitized(false).RenderValueAs(o => Html.ActionLink("Edit", "Edit", "UserManage", new { id = o.Id }, null));
            columns.Add().Encoded(false).Sanitized(false).RenderValueAs(u => Html.ActionLink("Delete", "Delete", "UserManage", new { id = u.Id }, null));
            columns.Insert(2, u => u.ProfilePictureUrl).Titled("User Img").Encoded(false).Sanitized(false).RenderValueAs(u => @<img class="" src="@u.ProfilePictureUrl" alt="Current Profile Image" width="75px" height="75px" />);

        }).AutoGenerateColumns()
</div>


I would welcome any input on this. I just learned about ASP.Net Identity during my time at Microsoft TechED 2014. I really like what I've played with so far, but would prefer not to have to get rid of my previous work done with Grid.MVC if possible :sweatdrop:

Is This A Good Question/Topic? 0
  • +

Page 1 of 1