Attention: PROnetworks has upgraded our forum from phpbb2 to phpbb3!!

Please head over to our new converted forum at: http://www.pronetworks.org/forums/

This old forum will remain 'read-only' until approximately February 2009. We look forward to seeing you at the new forum!
Author Message
Mac33
PostPosted: Wed Dec 24, 2003 9:09 am Reply with quote

PROfessional Member
 
 


Joined: 12 Mar 2002
Posts: 34345
Location: Scotland
XAML, Dynamic Properties, WinFS, and Indigo


Both Indigo and WinFS have similar ideas - that is, additional properties that are added without pre-declaration in the subject's type.


Indigo's support is the easiest to grok (for readers of this blog at least). We depend on the SOAP data and processing model for our messages, which already have the notion of composable and orthogonal extensions that do not require pre-declaration. We use this idiom in a few other places as well, but the SOAP envelope model is the most well-known and the most "in your face" for most indigo users. It's also the one that is stable going forward (SOAP/1.2 is done and there won't be a SOAP/1.3).

WinFS supports the concept of dynamic properties through what it calls "extensions." WinFS extensions are structured values that can be attached to items without the underlying item's type pre-declaring them.

In the PDC build of Longhorn, extensions are defined as new WinFS types in WinFS schema. The distinguishing characteristic is that extension types extend the built-in type Extension:

// WinFS (pseudo) schema declaration for new extension type
<Type Name="MarketingSpeakExtension" ExtendsType="Base.Extension">
<Field Name="CatchPhrase" Type="WinFSTypes.nvarchar(128)"/>
<Field Name="HypeFactor" Type="WinFSTypes.int"/>
<Field Name="IsFudable" Type="WinFSTypes.bit"/>
</Type>

Note that the "subject" of the extension is no where to be found. You can apply Marketing Speak to anything in the store (would you expect otherwise?).

Given this schema definition, the forthcoming WinFS schema compiler would produce a CLR type that looks something like this:

// generated code from WinFS schema compiler
public class MarketingSpeakExtension : System.Storage.Extension {
public string CatchPhrase { get; set; }
public int HypeFactor { get; set; }
public bool IsFudable { get; set; }
}

With the new extension type installed, our new marketing extension can be applied to items of arbitrary type. Here's an example:

// use of extension
void UseIt() {
ItemContext ctx = ItemContext.Open();
foreach (Item item in ctx.FindAll(typeof(Product))) {
MarketingSpeakExtension mse = new MarketingSpeakExtension();
mse.CatchPhrase = "New and Improved";
mse.HypeFactor = int.MaxValue;
mse.IsFudable = false;
item.Extensions.Add(mse);
}
ctx.Update();
}


This simple code fragment shows a WinFS client that pulls all of the products from the store and adds the extension using the Item base type's Extensions property.

The fact that Longhorn currently has three models for property extensibility instead of one is an accident of history. Whether or not there is enough common functionality and model here to do unification is still an open question.

:source: Don Box's Spotlet
 
Back to top
Back to top
Index >> Windows Vista Chat & Support >> XAML Dynamic Properties, WinFS,and Indigo

Page 1 of 1

 


Tired of the Ads? Registered users have 80% less adverts.