I know that when working with the first model development, you can use the partial classes generated by the t4 templates to add metadata. eg.
public partial class Address
{
public int Id { get; set; }
public string Street1 { get; set; }
public string Street2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
}
Then in a separate file I:
[MetadataType(typeof(AddressMetadata))]
public partial class Address {
}
internal sealed class AddressMetadata {
[Display(Name = "Street")]
public string Street1 { get; set; }
[Display(Name = "Street (cont.)")]
public string Street2 { get; set; }
[Display(Name = "Zip code")]
public string Zip { get; set; }
}
I am trying to do this for the type of enumeration defined in the EDMX file.
[MetadataType(typeof(ContactTypeMetadata))]
public enum ContactType {
}
public class ContactTypeMetadata {
}
By doing this, I get the following error:
Error 1 The namespace 'Models' already contains a definition for 'ContactType'
Is it necessary in any case to perform the same functions for enumerations as for classes in a project with the first model?
EDIT
In the EDMX file, I defined the type of enumeration:
namespace WindowsFormsApplication1
{
using System;
public enum ContactType : int
{
CEO = 0,
CIO = 1,
Peasant = 2
}
}
I am trying to find a way using a similar mechanism (in separate files so that if I change EDMX, my changes will not be overwritten) to accomplish this:
namespace WindowsFormsApplication1
{
using System;
public enum ContactType : int
{
[Display(Name="Chief Executive Officer")]
CEO = 0,
[Display(Name="Chief Information Officer")]
CIO = 1,
[Display(Name="Regular Employee")]
Peasant = 2
}
}