NotMapped Properties in an Entity Framework using a Code-First strategy

Using NotMapped Properties in an Entity Framework using a Code-First strategy in mvc
Note: This applies to any C# Application using Microsoft's Entity Framework using a Code-First strategy.

When working with entities, you may find yourself requiring the same set of derived data on a frequent basis.Worry not, the Entity Framework provides a useful attribute which you can use to add properties to an entity that are not mapped to the database, as shown here:

        // Dummy Field
        [NotMapped]
        [Display(Name = "User")]
        public string user_box { get; set; }
Using the NotMapped attribute you can create many useful properties that can save you a lot of time - and help keep your code looking clean to boot.
NotMapped Properties in an Entity Framework using a Code-First strategy NotMapped Properties in an Entity Framework using a Code-First strategy Reviewed by Bhaumik Patel on 10:47 PM Rating: 5