|
using System;
using Csla;
using Csla.Validation;
using System.Collections.Generic;
namespace Test
{
[Serializable]
public partial class A : BusinessBase<A>
{
#region Properties
private static PropertyInfo<int> aidProperty = RegisterProperty<int>(
typeof(A),
new PropertyInfo<int>("aid"));
/// <summary>
/// aid property
/// </summary>
public int aid
{
get { return GetProperty<int>(aidProperty); }
}
private static PropertyInfo<string> dataProperty = RegisterProperty<string>(
typeof(A),
new PropertyInfo<string>("data"));
/// <summary>
/// data property
/// </summary>
public string data
{
get { return GetProperty<string>(dataProperty); }
set { SetProperty<string>(dataProperty, value); }
}
private static PropertyInfo<System.Nullable<double>> valueProperty = RegisterProperty<System.Nullable<double>>(
typeof(A),
new PropertyInfo<System.Nullable<double>>("value"));
/// <summary>
/// value property
/// </summary>
public System.Nullable<double> value
{
get { return GetProperty<System.Nullable<double>>(valueProperty); }
set { SetProperty<System.Nullable<double>>(valueProperty, value); }
}
#endregion
#region Relationships
#endregion
#region Validation
protected override void AddBusinessRules()
{
Dictionary<string, object> dataArgs = new Dictionary<string, object>();
dataArgs.Add("MaxLength", 10);
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new DecoratedRuleArgs(dataProperty, dataArgs));
}
#endregion
}
} |