StrataFrame Forum

Use of ISite

http://forum.strataframe.net/Topic26301.aspx

By Bill Cunnien - 3/4/2010

I am not quite able to determine what the purpose of the following code is:





private ISite _Site;



[Browsable(false)]

public System.ComponentModel.ISite Site

{

get

{

return this._Site;

}

set

{

this._Site = value;

}

}





Since the _Site variable is private, and nothing in the class does anything with it, couldn't we do something like this:





[Browsable(false)]

public System.ComponentModel.ISite Site { get; set; }





My next question is, what outside of the class uses this property? I may find it as I am working on this...I'll post here as soon as I do.



Thanks,

Bill
By Greg McGuffey - 3/4/2010

Bill,



Where is this code? It looks familiar but I can't remember which class its in.
By Bill Cunnien - 3/5/2010

Project: StrataFlix.UI

Folder: Items and Collections

Class: ActionLinkMenuItem
By Bill Cunnien - 3/8/2010

(bump)



Smile
By Trent L. Taylor - 3/8/2010

This is added from the IComponent implementation. The components container uses this site reference to know what components have been added to any parent component container. This site reference is set through the designers and is required for proper component implementation. If you'll notice, when you add an action to any form, that action shows up in the component area of the form. This is how that is accomplished.
By Bill Cunnien - 3/8/2010

Ok...that'll give me some things to study (components and how they live in their environment, next on Nat Geo!) BigGrin



I am still wondering whether the syntax, public System.ComponentModel.ISite Site { get; set; }, would still work. I have it setup in my test case. Seems to be running just fine.
By Trent L. Taylor - 3/8/2010

I generally don't like to do that but prefer to define it explicitly, that way you always know exactly what is happening. But this is more of a personal preference thing. Smile