If you don’t know what Wings is, then read the <strong>earlier part</strong> of this series. There have been a number of changes since Part 1 and this part, namely the release of a new Longhorn build. For the Assemblies you will usually need the System.Storage.WinFS.dll assembly in most of your projects. It represents the basic interfaces and classes (for example, Item and ItemContext). In addition, System.Storage.Core.dll is required for most Wings work. Once you have both of those assemblies, most of the functional groups are separated into separate assemblies. For example, if you are working with Contacts, you will need the System.Storage.Contacts.dll assembly; if you are working with Files, you will need the System.Storage.Files.dll assembly. On some rare occasions, you will also need the WindowBase.dll assembly. This assembly contains much of the core Longhorn-specific content. All the Longhorn assemblies are now located in one place: \Microsoft.NET\Windows\v6.0.4030 (depending on the current version of the Longhorn assemblies).

Searching - Before you can work with Wings objects, you must first be able to find them. Searching Wings is fairly straightforward. It uses the OPath syntax that is part of ObjectSpaces. Searching within Wings begins with the ItemContext class. The ItemContext class supports a FindOne method that will return the first object that satisfies the search. The FindOne method takes a Type of the objects we are searching for and the OPath search string. FindOne returns either the first found object or null if no matches are found.

What is OPath? OPath is a specialised syntax for dealing with object graphs. OPath is made up of XPath sprinkled liberally with SQL syntax. At its most basic, OPath supports property comparisons. Microsoft has attempted to create a simple and powerful search language by merging ideas from XPath and SQL. Using OPath you can do:

  • Property Searches
  • Wildcard Searches
  • List Searches
  • Collection Element Searches
  • Compound Searches
  • Relationship Searches

You can learn more about the OPath <strong>here</strong> .

Conclusion:

Wings makes searching and manipulating Wings objects very straightforward. Searching through Wings allows us to specify a very simple syntax for most cases but supports a rich search syntax to perform complicated searches when needed. Searching by specifying the type of object we are looking for allows us to use the hierarchical nature of the Wings schema to our benefit when searching. In addition, the Wings API allows us to deal with Wings object like any other managed objects when we need to manipulate them. In most cases we can deal with Wings objects just like any other classes that we work with in our applications. The power here is that the API should be very intuitive for users of Wings objects. We can create objects, change objects by manipulating properties, delete objects, and save our changes in batches.

For more information check out: