And what about the 1012 and 1020 exception problems? Do they always appear?
Pascal.
jabber/gtalk: [EMAIL PROTECTED]
msn: [EMAIL PROTECTED]
On Tue, Dec 2, 2008 at 14:18, Jimbo1982 <[EMAIL PROTECTED]> wrote:
>
> Right some interesting yet puzzeling info. While trying your
> suggestion I found that if I moved the expression code out of a helper
> class into the class executing the loop. Let me explain with the
> example below eg 1. When run like this the caching does not appear to
> work and the Expression is built each time, however if I move the code
> in MyHelperClass.Execute into MyMasterClass at the position marked by
> ##### caching appears to work. Any ideas? I can't see what is
> different.
>
> In fact it only appears to work if the looping and expression build/
> execution are in the same method/place like eg 2.
>
> Hope that makes sense and helps.
>
> James
>
> eg 1
>
> class MyMasterClass{
>
> private Linq SchemaModel;
>
> public MyMasterClass(Linq model){
> SchemaModel = model;
> }
>
> public LoadData(){
> MyHelperClass helper = new MyHelperClass(SchemaModel)
>
> List<string> myStrings = new List<string>();
> myStrings.Add("AZP1B");
> myStrings.Add("AZP1C");
> myStrings.Add("AZP1D");
> myStrings.Add("AZP2B");
> myStrings.Add("AZP2C");
> myStrings.Add("AZP2D");
> myStrings.Add("AZP3B");
> myStrings.Add("AZP3C");
> myStrings.Add("AZP3D");
>
> foreach(string s in mystrings){
> List<WarehouseStation> mystations = helper.Execute(s);
> //######
> foreach(Station station in mystations){
> Console.Out.WriteLine(station.Id);
> }
> }
> }
> }
>
> public class MyHelperClass{
>
> private Linq HelperSchemaModel;
>
> public MyHelperClass(Linq model){
> HelperSchemaModel = model;
> }
>
> public List<WarehouseStation> Execute(string s){
> var stations = from station in SchemaModel.Station where
> station.AisleID == s select station;
>
> List<WarehouseStation> allWarehouseStations = new
> List<WarehouseStation>();
> foreach (var s in stations)
> {
> WarehouseStation warehouseStation = new
> WarehouseStation(s.StationID, s.XCooRd.Value);
> allWarehouseStations.Add(warehouseStation);
> }
> return allWarehouseStations;
> }
> }
>
> eg 2
>
> foreach (string s in ss)
> {
> var tmp = from tmptbl in SchemaModel.Station where
> tmptbl.AisleID == s select tmptbl;
> foreach (var a in tmp)
> {
> Console.Out.WriteLine(a.AisleID + " - " +
> a.StationID + " - " + a.XCooRd);
> }
> }
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---