i have resolved this issue by myself.
The main reason , why this wont work , hide in realization of property:
public string Speciality { get; set; }
As concerns this property i have change it type to, see below:
public IEnumerable<string> Specialty { get; set; } </string>
and changed a bit my query:
var item2 = (from item in _context.Physician.Include("PersonalInfo").Include(x => x.PhysicianSpecialty).Include("PhysicianSpecialty.Speciality")
let specialities = (from spec in _context.PhysicianSpecialty
where spec.PhysicianID == item.PhysicianID
select spec.Specialty)
select new Models.PhysicianInfo2()
{
NPI = item.NPI,
Email = item.PersonalInfo.Email,
FirstName = item.PersonalInfo.FirstName,
LastName = item.PersonalInfo.LastName,
MiddleName = item.PersonalInfo.MiddleName,
Prefix = item.PersonalInfo.Prefix,
Suffix = item.PersonalInfo.Suffix,
Specialty = specialities,
Institution = string.Empty
});
String representation of IEnumerable of string irepresented like this:
public string SpecialityString
{
get{return Specialty==null?string.empty:Specialty.Aggregate((a, b) =>
string.Format("{0}, {1}", a, b));
}
}