Given the code below, what do I need at XXXX to have LanguageID == CustomerEntity.BusinessLanguageID [from this bit -> Prefetch<CustomerEntity>(cn => cn.Customer] - they're both Guids and so is languageId
I've tried
td.Country.Customer.First().BusinessCountryId
which resulted in a 'No coercion operator is defined between types '.EntityClasses.CustomerEntity' and 'System.Guid'.' error.
Help!, Many thanks for looking. N
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
LinqMetaData metaData = new LinqMetaData(adapter);
var contracts = (
from cn in metaData.Contract
where cn.ContractId == contractId
select cn)
.WithPath(
pt1 => pt1
// store
.Prefetch<StoreEntity>(cn => cn.Store)
.Include(s => s.StoreName)
// customer
// only returning those fields required along with translated country name
.Prefetch<CustomerEntity>(cn => cn.Customer)
.Include(cs => cs.CustomerId, cs => cs.Surname, cs => cs.Forename, cs => cs.Address, cs => cs.City, cs => cs.Zip, cs => cs.IdType, cs => cs.IdNumber, cs => cs.IdExpiryDate, cs => cs.TelephoneNumber, cs => cs.Type,
cs => cs.BusinessName, cs => cs.BusinessAddress, cs => cs.BusinessCity, cs => cs.BusinessZip, cs => cs.BusinessUser, cs => cs.BusinessVatnumber, cs => cs.EmailAddress, cs => cs.IsGovernmentUser)
.SubPath(pt2 => pt2.Prefetch<CountryEntity>(cs => cs.Country)
.Include(co => co.CountryId, co => co.CountryName)
.SubPath(pt3 => pt3.Prefetch<TranslationDictionaryEntity>(co => co.TranslationDictionary)
.Include(td => td.TranslatedText)
.FilterOn(td => td.LanguageId == languageId && td.ColumnName == "COUNTRYNAME")
)
)
.SubPath(pt2 => pt2.Prefetch<CountryEntity>(cs => cs.BusinessCountry)
.Include(co => co.CountryId, co => co.CountryName)
.SubPath(pt3 => pt3.Prefetch<TranslationDictionaryEntity>(co => co.TranslationDictionary)
.Include(td => td.TranslatedText)
.FilterOn(td => td.LanguageId == XXXXX && td.ColumnName == "COUNTRYNAME")
)
)
-- there was a missing part to the FilterOn lambda which I have now fixed.