Hi Guys,
I have one MVC application which is integarted with CRM. So whenever i click a link it downloads country list from CRM at that it throws error.
I am pasting the code where I am getting error.
public static CRMhelperClass{
private static xxxContext _context = new xxxContext("Xrm"); -- xxxContext is a class
private static List<CountryDto> GetCountryList(){
List<CountryDto> countries = null;
var query = from z in _context.xxxx_countrySet -- _context is object
where z.statecode == 0
orderby z.xxx_name ascending
select new CountryDto()
{
Id = z.xxx_countryId.Value,
Name = z.xxx_name,
Region = (Enums.CustomerServiceRegion)z.xxx_region.Value
};
countries = query.ToList<CountryDto>(); --- I am getting error here
return countries;
}
}
//Its a system generated code
[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "7.1.0001.6557")]
public partial class xxxContext : Microsoft.Xrm.Client.CrmOrganizationServiceContext // its object is being used in above
{
public Microsoft.Xrm.Client.CrmEntityReference xxx_country
{
get
{
return this.GetAttributeValue<Microsoft.Xrm.Sdk.EntityReference>("xxx_country");
}
set
{
this.SetAttributeValue<Microsoft.Xrm.Sdk.EntityReference>("xxx_country", "xxx_country", value);
}
}
}
I am not getting where is the error. On debug only I get error at "countries = query.ToList<CountryDto>()" that i have indicated.
Debuging is not allowed in system generated code.
Pls help I ambadly stucked here.
Thanks in advance.