g.vilkner

AF SDK 2012: AFElement.Attributes.Where(x=>x.***==***)... Doesn't Work Anymore.

Discussion created by g.vilkner on Jan 15, 2013
Latest reply on Jan 17, 2013 by g.vilkner

Dear VCampus team,

 

We have existing code base using linq statements in AF SDK code, that all of a sudden doesn't compile anymore since we installed the all new AF SDK 2012. There is the following error message:

 

Error 1 'OSIsoft.AF.Asset.AFAttributes' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'OSIsoft.AF.Asset.AFAttributes' could be found (are you missing a using directive or an assembly reference?) D:\CodeProjects\B2\ConsoleApplication1\ConsoleApplication1\Program.cs 22 55 ConsoleApplication1

 

Here's a "Hello World" that runs in a console application to test this. We coulnd't get this to work with either AFSDK 2.0 nor 4.0

 

PISystem aPiSystem = new PISystems()["somePiSystem"];
AFDatabase aAfDb=aPiSystem.Databases["someAfDb"];

 

AFElement aAfElement = aAfDb.Elements["someElementName"];
AFAttributes aAfAttributes = aAfElement.Attributes;

 

IEnumerable<AFAttribute> someAttributes = aAfAttributes.Where(x => x.Name == "sdlkfj");

 

Not sure if we are missing a reference or if we have to dig out some old dll's that might have fallen off the train. But any help would be appreciated.

 

Kind regards,

 

Gregor

Outcomes