I have a table of warranties in my SQL database. These are represented by Warranty objects generated via LINQ to SQL. I've extended the partial classes generated to have a new property called Address, which is a combination of each address line field. (There is a bit of logic in there too through).Code:public string Address { get { return (!string.IsNullOrEmpty(AddressLine1) ? AddressLine1 + " " : "") + (!string.IsNullOrEmpty(AddressLine2) ? AddressLine2 + " " : "") + (!string.IsNullOrEmpty(AddressLine3) ? AddressLine3 + " " : "") + (!string.IsNullOrEmpty(AddressLine4) ? AddressLine4 + " " : "") + (!string.IsNullOrEmpty(AddressLine5) ? AddressLine5 + " " : "") + (!string.IsNullOrEmpty(Postcode) ? Postcode + " " : ""); } }
I get the following error if i try and build a LINQ query using the property, which is kind of expected, but also kind of annoying!What do i have to do in order for this property getter to work in a LINQ query?Code:System.NotSupportedException: The member 'HomeserveSharedClasses.DAL.Warranty.Address' has no supported translation to SQL.





Reply With Quote