70 lines
1.4 KiB
C#
70 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Csla;
|
|
using System.Collections;
|
|
namespace Volian.CSLA.Library
|
|
{
|
|
[Serializable]
|
|
public class VEReadOnlyBase<T> : ReadOnlyBase<T>, IVEReadOnlyItem
|
|
where T : ReadOnlyBase<T>
|
|
{
|
|
#region Generic methods
|
|
protected int _id = 0;
|
|
protected string _name = string.Empty;
|
|
protected IList _children = null;
|
|
public IList GetChildren()
|
|
{
|
|
if (_children == null)LoadChildren(Id);
|
|
return _children;
|
|
}
|
|
public bool GetChildrenLoaded()
|
|
{
|
|
return _children != null;
|
|
}
|
|
public virtual bool HasChildren()
|
|
{
|
|
return true;//Not sure whether to default this to true or false
|
|
}
|
|
public int Id
|
|
{
|
|
get { return _id; }
|
|
}
|
|
public string Name
|
|
{
|
|
get { return _name; }
|
|
}
|
|
protected override object GetIdValue()
|
|
{
|
|
return _id;
|
|
}
|
|
#endregion
|
|
#region Item Specific
|
|
public override string ToString()
|
|
{
|
|
return _name;
|
|
}
|
|
protected virtual void LoadChildren(int id)
|
|
{
|
|
}
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
public VEReadOnlyBase()
|
|
{ /* require use of factory methods */ }
|
|
|
|
#endregion
|
|
}
|
|
//public class VERODataPath : VEReadOnlyBase<VERODataPath>
|
|
//{
|
|
// private VERODataPath() : base() { ;}
|
|
// public VERODataPath(int id, string name) : base(id, name) { ;}
|
|
//}
|
|
//public class VEROPlant : VEReadOnlyBase<VEROPlant>
|
|
//{
|
|
// private VEROPlant() : base() { ;}
|
|
// public VEROPlant(int id, string name) : base(id, name) { ;}
|
|
//}
|
|
}
|