StrataFrame Forum

Creating Base Classes

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

By Ger Cannoll - 11/8/2009

I want to SubClass all the relevant SF classes and am looking for guidance/ best practise. Also if there are any utilities for dong this

At this stage I dont want to build in any additional functionality but will want to do so in the future the following. Is it sufficient to do the following for each of the classes:

e.g.

public class MyBaseBo : MicroFour.StartaFrame.BusinessLayer
{
}

public class MyBaseTextBox : MicroFour.StrataFrame.UI.Windows.Forms.Textbox
{
}

or do I need to refer to Methods inside each class

(e.g. In VFP terms, do I need to put in a DoDeafult() for each method

By Greg McGuffey - 11/9/2009

This is enough. Then if you want to add an additional property or method, you just add it to your class. You will be able to reference any property of the base class via the normal "this" reference. If you override methods or properties, you'd then use "base" to reference the base class. E.g.



public override string ToString()

{

  //-- Establish a return var

  string text;



  //-- Get value returned by base class

  text = base.ToString();



  //-- Based on existing value of some other property, append some other text

  if (this.BindingField != null)

  {

    text += ": bound";

  }



  return text;

}




When I first started realizing how easy this was, it almost felt like cheating...just too easy BigGrin
By Ger Cannoll - 11/9/2009

Hi Greg. Thanks again for your reply.

Inmitially then it would appear to be quite straightforward.....just sub class ALL the Staratframe Controls with a {}