Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Howto FilterOn()
 

Pages: 1
Bugs & Issues
Howto FilterOn()
Page:1/1 

  Print all messages in this thread  
Poster Message
neil.allen
User



Location:

Joined on:
03-Jun-2020 14:45:45
Posted:
2 posts
# Posted on: 03-Jun-2020 15:14:54.  
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
Code:
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

Code:

            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.
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14626 posts
# Posted on: 04-Jun-2020 05:22:34.  
This test worked for me on Northwind.
Code:
var q = (from c in metaData.Customer
         select c)
        .WithPath(p => p
        .Prefetch<OrderEntity>(c => c.Orders)
        .SubPath(op => op.Prefetch<EmployeeEntity>(o => o.Employee)
        .FilterOn(e => e.Orders.First().Customer.Country == e.Country)));



  Top
neil.allen
User



Location:

Joined on:
03-Jun-2020 14:45:45
Posted:
2 posts
# Posted on: 04-Jun-2020 12:03:31.  
The info from WALAA helped me with this, thanks.
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.