Hi There
I'm trying to get an entity collection with related info down from a web service with minimal load.
Using .Net Version 2, LLBLGenPro V 2.6 Build 12 October. Using the 2 Calasses Template, Adapter.
the simplest way with the least headache seems to be .Writexml ( then .Readxml in the client. )
The structure looks something like this
ShopOrders
ShopCountry ( using ShopOrders.DelcountryID )
ShopCountry ( using ShopOrders.BuyercountryID )
OrderLines ( using ShopOrders.ID )
ShopProductVariations ( using ShopOrderLines.VariationID )
Now maybe it's because ShopCountry is linked twice to the same table , but when I write to XML, the XML is HUGE. 100 rows = about 7MB. Is this a bug or the way I'm writing the code?
The xml looks a bit like this. I wouldn't expect the <ShopOrders_> xml to exist at all.
It's like it's doing the relationship down from ShopOrders to Country and then back up to ShopOrders again on each of the 100 rows!
<ShopOrdersEntity ObjectID=\"71e9fddf-5aae-4a80-bb19-83236b183c7e\">
<BuyerCountry ObjectID=\"2b570415-89d5-43ca-bbf5-01009f9f8512\">
<Id>11</Id>
<CountryName>AUSTRALIA</CountryName>
<ShopOrders_>
<ShopOrdersEntity Ref=\"71e9fddf-5aae-4a80-bb19-83236b183c7e\" />
<ShopOrdersEntity ObjectID=\"c7fea04f-c907-4a10-a511-0f59c40fd715\">
Here is the Code. Any ideas? Any help is much appreciated.
There are no Entities Added twice in the LLBLGen Gui.
ExcludeIncludeFieldsList buyercountryfields = new ExcludeIncludeFieldsList(false);
ExcludeIncludeFieldsList deliverycountryfields = new ExcludeIncludeFieldsList(false);
buyercountryfields.Add(ShopCountriesFields.CountryName);
deliverycountryfields.Add(ShopCountriesFields.CountryName);
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.ShopOrdersEntity);
prefetchPath.Add(ShopOrdersEntity.PrefetchPathShopOrderLines).SubPath.Add(ShopOrderLinesEntity.PrefetchPathShopProductVariations);
prefetchPath.Add(ShopOrdersEntity.PrefetchPathBuyerCountry, buyercountryfields);
prefetchPath.Add(ShopOrdersEntity.PrefetchPathDeliveryCountry, deliverycountryfields);
EntityCollection<ShopOrdersEntity> orders = new EntityCollection<ShopOrdersEntity>();
ISortExpression sorter = new SortExpression();
sorter.Add(ShopOrdersFields.Id | SortOperator.Ascending);
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.CatalogNameToUse = catalog;
adapter.ConnectionString = ConfigurationManager.ConnectionStrings[company].ConnectionString;
adapter.FetchEntityCollection(orders, filter, 100, sorter, prefetchPath);
}
String retval = "";
orders.WriteXml(XmlFormatAspect.Compact25, out retval);
return retval;