Sometimes I’m being asked how to add metadata to a generated entity in Entity Framework. This metadata can be data annotation or other attributes which can help the developer during runtime. One answer that I give is to edit the T4 template in order to add the attributes. This solution can be combined with the building of an extension to Entity Framework designer which can add more details to the EDM. But it can take some time to develop. Another solution is to create a MetadataType for the entity and use the entity’s partial class behavior to add this type. This post will show you the second solution.