Class 1
public partial class Profile : BaseEntity
{
#region Properties
/// <summary>
/// Gets or sets the Profile identifier
/// </summary>
public int ProfileId { get; set; }
/// <summary>
/// Gets or sets the FullName
/// </summary>
public string FullName { get; set; }
/// <summary>
/// Gets or sets the Gender
/// </summary>
public string Gender { get; set; }
/// <summary>
/// Gets or sets the DateofBirth
/// </summary>
public DateTime DateofBirth { get; set; }
}
Class 2
public partial interface IProfileService
{
/// <summary>
/// Gets an Profile by profile identifier
/// </summary>
/// <param name="profileid">profile identifier</param>
/// <returns>Profile</returns>
Profile GetProfileById(int profileid);
/// <summary>
/// Gets all Profiles
/// </summary>
/// <returns>Profile collection</returns>
List<Profile> GetAllProfiles();
}
Class 3
public partial class ProfileService : IProfileService
{
/// <summary>
/// Gets a profile by profile identifier
/// </summary>
/// <param name="profileId">Profile identifier</param>
/// <returns>profile</returns>
public Profile GetProfileById(int profileid)
{
if (profileid == 0)
return null;
var query = from a in _context.Profilemasters
where a.ProfileId == profileid
select a;
var profile = query.SingleOrDefault();
return profile;
}
}
In Class 3 of return profile I get an error Message that "Cannot Implicitly Convert 'Data.Profilemaster' to 'Library.Profile'. Whareas Data.Profilemaster is an Entity table amd Library.Profile is Class ie. Class 1.
And when I use "MyContext.Profilemasters.AddObject(profile);" command to insert data I get another Error Message ie. "The Best Overloaded Method match for...."
Please help Me.
I am New in Entrity Framework.
Anybody has the Idea to solve this