Subclassing Examples in C#

Subclassing Examples in C#

Old forum URL: forums.lhotka.net/forums/t/2543.aspx


JabbaTheNut posted on Saturday, March 17, 2007

I was searching for quite a long time to find examples of subclassing each of the 7 CSLA base classes.  I finally found the following post:

http://forums.lhotka.net/forums/thread/9544.aspx

I thought I would consolidate the C# examples from that post under a different subject header that might make them easier to find. 

It would be nice if these examples were posted in the FAQ for newbies like myself.  Anyway, here they are:

[Serializable()]
public abstract class MyBusinessBase<T> : Csla.BusinessBase<T> where T : MyBusinessBase<T>
{
}

[Serializable()]
public abstract class MyBusinessListBase<T, C> : Csla.BusinessListBase<T, C> where T : MyBusinessListBase<T, C> where C : Csla.Core.IEditableBusinessObject
{
}

[Serializable()]
public abstract class MyCommandBase : Csla.CommandBase
{
}

[Serializable()]
public abstract class MyNameValueListBase<K, V> : Csla.NameValueListBase<K, V>
{
}

[Serializable()]
public abstract class MyReadOnlyBase<T> : Csla.ReadOnlyBase<T> where T : MyReadOnlyBase<T>
{
}

[Serializable()]
public abstract class MyReadOnlyListBase<T, C> : Csla.ReadOnlyListBase<T, C> where T : MyReadOnlyListBase<T, C> where C : Csla.Core.IReadOnlyObject
{
}

[Serializable()]
public abstract class MyEditableRootListBase<T> : Csla.EditableRootListBase<T>  where T : Csla.Core.IEditableBusinessObject, Csla.Core.ISavable
{
}

Copyright (c) Marimer LLC