New to c# and new to CSLA 4.0 (came from cslavb2.014).
How do I implement properties from inherited base class?
PurchaseOrderBase.cs inherited by PurchaseOrder.cs and DockAppointmentPO for two different use cases.
public abstract class PurchaseOrderBase : BusinessBase<PurchaseOrderBase>
{
private static readonly PropertyInfo<string> PurchaseOrderNumberProperty = RegisterProperty<string>(p => p.PurchaseOrderNumber);
public string PurchaseOrderNumber { get; protected set; }
[Serializable]
public class PurchaseOrder : PurchaseOrderBase
{
[Serializable]
public class DockAppointmentPO : BusinessBase<PurchaseOrderBase>
{
I expected to be able to access PurchaseOrder.PurchaseOrderNumber
Sorry for such a basic question.
Well, you actually want to create an intermediate base class with common properties - not necessarily abstract properties. So your intermediate class must also be generic, like:
public class PurchaseOrderBase<T> : BusinessBase<T> where T: BusinessBase<T>
{
......
AND
public class PurchaseOrder : PurchaseOrderBase<PurchaseOrder>
{
......
And I would strongly suggest that you use the CSLA Snippets and create managed properties - automatic properties do not work so well as managed properties ......
You will find several examples of intermediate classes in the form and in the MyCsla samples at http://cslacontrib.codeplex.com
You may also look into these introduction articles on generics:
http://msdn.microsoft.com/en-us/magazine/cc163683.aspx
http://msdn.microsoft.com/en-us/library/ms379564%28v=vs.80%29.aspx
Thanks all. That did it.
Copyright (c) Marimer LLC