I've got an EDMX diagram generated from a SQL Server database. It generates a partial class like the following:-
public partial class Profile
{
public Profile()
{
// Constructor Info here
}
// Various string/int/bit properties
public virtual ICollection<ProfileImage> ProfileImages { get; set; }
}
The ICollection at the bottom is a sub table linked via the Primary Key from Profile. In this table is a string with an image file name for the profile.
I wanted to be able to add an addition property to this class to pre-pend a folder structure before the file name, and I tried the following, but I get a compile error:-
public partial class Profile
{
public string ImageFileName { get; set; }
public string ProfileImageURL
{
get
{
return "~/images/folder/folder/" + this.ImageFileName;
}
}
}
The error is fairly obvious: Profile is ambiguous between 'XXX' and 'YYY'. But they are two partial classes, and I thought this could work? How do I amend this to add my own properties onto a DB generated class from the EDMX?
Thanks in advance!