- Problem:
Class contains backend field, but is not registered
If you don’t do it, exception Csla.PropertyLoadException will be raised with message
private int _my_field;
private static readonly PropertyInfo<int> MyFieldProperty = RegisterProperty<int>(o => o.MyField, "My field", RelationshipTypes.PrivateField);
public int MyField
{
get { return GetProperty(MyFieldProperty, _my_field); }
set { SetProperty(MyFieldProperty, ref _my_field, value); }
}
<p>LoadProperty(MyFieldProperty, 10);</p>
_my_field = 10;
- Problem :
private readonly int _my_field;
Make field static
private static readonly int _my_field;
- Problem:
[Serializable]
public class MyBaseClass<T> : BusinessBase<T> where T : MyBaseClass<T>
{
}
[Serializable]
public class MyConcreteClass : MyBaseClass<MyConcreteClass>
{
protected static PropertyInfo<string> ConcretePropProperty = RegisterProperty(typeof(MyConcreteClass), new PropertyInfo<string>("ConcretePropProperty"));
public string ConcreteProp
{
get { return GetProperty(ConcretePropProperty); }
set { SetProperty(ConcretePropProperty, value); }
}
}
and if properties in MyBaseClass are not registered exception raised with message:
- Problem:
Class is inherited from BusinessListBase or BusinessBindingListBase. Adding new items in collection cannot be done.
