9using System.Collections.Concurrent;
10using System.Diagnostics;
12using System.Collections.Generic;
13using System.ComponentModel;
14using System.Threading.Tasks;
16using System.Collections.Specialized;
17using System.ComponentModel.DataAnnotations;
18using System.Collections.ObjectModel;
27using System.Reflection;
28using System.Collections;
38 [System.Diagnostics.DebuggerStepThrough]
74 InitializeBusinessRules();
91 private int _identity = -1;
95 get {
return _identity; }
98 private void InitializeIdentity()
100 _identity = ((IParent)
this).GetNextIdentity(_identity);
105 private IdentityManager _identityManager;
107 int IParent.GetNextIdentity(
int current)
115 if (_identityManager ==
null)
116 _identityManager =
new IdentityManager();
117 return _identityManager.GetNextIdentity(current);
123 #region Parent/Child link
127 private IParent _parent;
137 [Display(AutoGenerateField =
false)]
138 [ScaffoldColumn(
false)]
139 [EditorBrowsable(EditorBrowsableState.Advanced)]
142 get {
return _parent; }
154 _identityManager =
null;
155 InitializeIdentity();
160 #region IsNew, IsDeleted, IsDirty, IsSavable
163 private bool _isNew =
true;
164 private bool _isDeleted;
165 private bool _isDirty =
true;
181 [Display(AutoGenerateField =
false)]
182 [ScaffoldColumn(
false)]
185 get {
return _isNew; }
203 [Display(AutoGenerateField =
false)]
204 [ScaffoldColumn(
false)]
207 get {
return _isDeleted; }
230 [Display(AutoGenerateField =
false)]
231 [ScaffoldColumn(
false)]
255 [Display(AutoGenerateField =
false)]
256 [ScaffoldColumn(
false)]
259 get {
return _isDirty; }
356 [EditorBrowsable(EditorBrowsableState.Advanced)]
408 [EditorBrowsable(EditorBrowsableState.Advanced)]
415 foreach (var name
in propertyNames)
430 foreach (var name
in propertyNames)
443 [EditorBrowsable(EditorBrowsableState.Advanced)]
447 if (_fieldManager !=
null)
467 [Display(AutoGenerateField =
false)]
468 [ScaffoldColumn(
false)]
486 #region Authorization
490 private ConcurrentDictionary<string, bool> _readResultCache;
493 private ConcurrentDictionary<string, bool> _writeResultCache;
496 private ConcurrentDictionary<string, bool> _executeResultCache;
499 private System.Security.Principal.IPrincipal _lastPrincipal;
506 [EditorBrowsable(EditorBrowsableState.Advanced)]
511 VerifyAuthorizationCache();
513 if (!_readResultCache.TryGetValue(property.Name, out result))
519 _readResultCache.AddOrUpdate(property.Name, result, (a,b) => { return result; });
533 [EditorBrowsable(EditorBrowsableState.Advanced)]
537 if (throwOnFalse && result ==
false)
540 String.Format(
"{0} ({1})",
552 [EditorBrowsable(EditorBrowsableState.Advanced)]
568 if (propertyInfo ==
null)
570 Trace.TraceError(
"CanReadProperty: {0} is not a registered property of {1}.{2}", propertyName, this.GetType().Namespace, this.GetType().Name);
581 [EditorBrowsable(EditorBrowsableState.Advanced)]
586 VerifyAuthorizationCache();
588 if (!_writeResultCache.TryGetValue(property.Name, out result))
594 _writeResultCache.AddOrUpdate(property.Name, result, (a, b) => { return result; });
608 [EditorBrowsable(EditorBrowsableState.Advanced)]
612 if (throwOnFalse && result ==
false)
626 [EditorBrowsable(EditorBrowsableState.Advanced)]
642 if (propertyInfo ==
null)
644 Trace.TraceError(
"CanReadProperty: {0} is not a registered property of {1}.{2}", propertyName, this.GetType().Namespace, this.GetType().Name);
650 private void VerifyAuthorizationCache()
652 if (_readResultCache ==
null)
653 _readResultCache =
new ConcurrentDictionary<string, bool>();
654 if (_writeResultCache ==
null)
655 _writeResultCache =
new ConcurrentDictionary<string, bool>();
656 if (_executeResultCache ==
null)
657 _executeResultCache =
new ConcurrentDictionary<string, bool>();
658 if (!ReferenceEquals(ApplicationContext.
User, _lastPrincipal))
661 _readResultCache.Clear();
662 _writeResultCache.Clear();
663 _executeResultCache.Clear();
664 _lastPrincipal = ApplicationContext.
User;
674 [EditorBrowsable(EditorBrowsableState.Advanced)]
679 VerifyAuthorizationCache();
681 if (!_executeResultCache.TryGetValue(method.Name, out result))
687 _executeResultCache.AddOrUpdate(method.Name, result, (a, b) => { return result; });
701 [EditorBrowsable(EditorBrowsableState.Advanced)]
706 if (throwOnFalse && result ==
false)
723 [EditorBrowsable(EditorBrowsableState.Advanced)]
733 if (throwOnFalse && result ==
false)
743#region System.ComponentModel.IEditableObject
745 private bool _neverCommitted =
true;
747 private bool _disableIEditableObject;
765 [EditorBrowsable(EditorBrowsableState.Advanced)]
770 return _disableIEditableObject;
774 _disableIEditableObject = value;
786 void System.ComponentModel.IEditableObject.BeginEdit()
805 void System.ComponentModel.IEditableObject.CancelEdit()
811 if (
IsNew && _neverCommitted && EditLevel <= EditLevelAdded)
833 void System.ComponentModel.IEditableObject.EndEdit()
844#region Begin/Cancel/ApplyEdit
866 CopyState(this.EditLevel + 1);
880 UndoChanges(this.EditLevel - 1);
894 InitializeBusinessRules();
896 base.UndoChangesComplete();
909 _neverCommitted =
false;
910 AcceptChanges(this.EditLevel - 1);
922 base.AcceptChangesComplete();
934 private bool _isChild;
940 [Display(AutoGenerateField =
false)]
941 [ScaffoldColumn(
false)]
944 get {
return _isChild; }
987 internal void DeleteChild()
998#region Edit Level Tracking (child only)
1004 private int _editLevelAdded;
1014 internal int EditLevelAdded
1016 get {
return _editLevelAdded; }
1017 set { _editLevelAdded = value; }
1020 int IUndoableObject.EditLevel
1024 return this.EditLevel;
1032 object ICloneable.Clone()
1043 [EditorBrowsable(EditorBrowsableState.Advanced)]
1051#region BusinessRules, IsValid
1055 private EventHandler _validationCompleteHandlers;
1064 _validationCompleteHandlers = (EventHandler)
1065 System.Delegate.Combine(_validationCompleteHandlers, value);
1069 _validationCompleteHandlers = (EventHandler)
1070 System.Delegate.Remove(_validationCompleteHandlers, value);
1077 [EditorBrowsable(EditorBrowsableState.Never)]
1080 if (_validationCompleteHandlers !=
null)
1081 _validationCompleteHandlers(
this, EventArgs.Empty);
1084 private void InitializeBusinessRules()
1087 if (!rules.Initialized)
1089 if (!rules.Initialized)
1094 rules.Initialized =
true;
1118 if (_businessRules ==
null)
1120 else if (_businessRules.Target ==
null)
1121 _businessRules.SetTarget(
this);
1122 return _businessRules;
1132 [EditorBrowsable(EditorBrowsableState.Never)]
1146 OnBusyChanged(
new BusyChangedEventArgs(property.Name,
false));
1160 void Rules.IHostRules.AllRulesComplete()
1203 [Display(AutoGenerateField =
false)]
1204 [ScaffoldColumn(
false)]
1226 [Display(AutoGenerateField =
false)]
1227 [ScaffoldColumn(
false)]
1238 [Display(AutoGenerateField =
false)]
1239 [ScaffoldColumn(
false)]
1240 [System.ComponentModel.DataAnnotations.Schema.NotMapped]
1241 [EditorBrowsable(EditorBrowsableState.Advanced)]
1256 [EditorBrowsable(EditorBrowsableState.Advanced)]
1265 [EditorBrowsable(EditorBrowsableState.Advanced)]
1275 [EditorBrowsable(EditorBrowsableState.Advanced)]
1298 [EditorBrowsable(EditorBrowsableState.Advanced)]
1307 [EditorBrowsable(EditorBrowsableState.Advanced)]
1317 [EditorBrowsable(EditorBrowsableState.Advanced)]
1323 #region IDataErrorInfo
1325 string IDataErrorInfo.Error
1337 IEnumerable INotifyDataErrorInfo.GetErrors(
string propertyName)
1342 bool INotifyDataErrorInfo.HasErrors => !
IsSelfValid;
1344 string IDataErrorInfo.this[
string columnName]
1348 string result =
string.Empty;
1351 Rules.BrokenRule rule =
1362 private EventHandler<DataErrorsChangedEventArgs> _errorsChanged;
1364 event EventHandler<DataErrorsChangedEventArgs> INotifyDataErrorInfo.ErrorsChanged
1368 _errorsChanged = (EventHandler<DataErrorsChangedEventArgs>)
1369 System.Delegate.Combine(_errorsChanged, value);
1373 _errorsChanged = (EventHandler<DataErrorsChangedEventArgs>)
1374 System.Delegate.Remove(_errorsChanged, value);
1384 _errorsChanged?.Invoke(
this,
new DataErrorsChangedEventArgs(propertyName));
1397 [EditorBrowsable(EditorBrowsableState.Advanced)]
1400 base.OnPropertyChanged(propertyInfo);
1406 #region Serialization Notification
1410 OnDeserializedHandler(
new System.Runtime.Serialization.StreamingContext());
1413 [System.Runtime.Serialization.OnDeserialized]
1414 private void OnDeserializedHandler(System.Runtime.Serialization.StreamingContext context)
1417 if (_fieldManager !=
null)
1419 InitializeBusinessRules();
1420 FieldDataDeserialized();
1430 [EditorBrowsable(EditorBrowsableState.Advanced)]
1431 protected virtual void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
1436#region Bubbling event Hooks
1442 [EditorBrowsable(EditorBrowsableState.Never)]
1452 [EditorBrowsable(EditorBrowsableState.Never)]
1460 if (unhandled !=
null)
1463 INotifyPropertyChanged pc = child as INotifyPropertyChanged;
1465 pc.PropertyChanged += Child_PropertyChanged;
1467 IBindingList bl = child as IBindingList;
1469 bl.ListChanged += Child_ListChanged;
1471 INotifyCollectionChanged ncc = child as INotifyCollectionChanged;
1473 ncc.CollectionChanged += Child_CollectionChanged;
1484 [EditorBrowsable(EditorBrowsableState.Never)]
1494 [EditorBrowsable(EditorBrowsableState.Never)]
1502 if (unhandled !=
null)
1505 INotifyPropertyChanged pc = child as INotifyPropertyChanged;
1507 pc.PropertyChanged -= Child_PropertyChanged;
1509 IBindingList bl = child as IBindingList;
1511 bl.ListChanged -= Child_ListChanged;
1513 INotifyCollectionChanged ncc = child as INotifyCollectionChanged;
1515 ncc.CollectionChanged -= Child_CollectionChanged;
1524#region Busy / Unhandled exception bubbling
1526 private void Child_UnhandledAsyncException(
object sender,
ErrorEventArgs e)
1531 private void Child_BusyChanged(
object sender, BusyChangedEventArgs e)
1538#region IEditableBusinessObject Members
1540 int IEditableBusinessObject.EditLevelAdded
1544 return this.EditLevelAdded;
1548 this.EditLevelAdded = value;
1552 void IEditableBusinessObject.DeleteChild()
1557 void IEditableBusinessObject.SetParent(IParent parent)
1564#region Register Methods
1581 var reflected = objectType.GetMethod(info.
Name);
1582 if (reflected ==
null)
1609#region Register Properties
1629 return Core.FieldManager.PropertyInfoManager.RegisterProperty<P>(objectType, info);
1634#region Get Properties
1656 return GetProperty<P>(propertyName, field, defaultValue, Security.NoAccessBehavior.SuppressException);
1675 protected P
GetProperty<P>(
string propertyName, P field, P defaultValue, Security.NoAccessBehavior noAccess)
1677#region Check to see if the property is marked with RelationshipTypes.PrivateField
1686 if (_bypassPropertyChecks ||
CanReadProperty(propertyInfo, noAccess == Security.NoAccessBehavior.ThrowException))
1689 return defaultValue;
1754 return Utilities.CoerceValue<P>(typeof(F),
null, GetProperty<F>(propertyInfo.
Name, field, propertyInfo.
DefaultValue, Security.NoAccessBehavior.SuppressException));
1781 return Utilities.CoerceValue<P>(typeof(F),
null, GetProperty<F>(propertyInfo.
Name, field, propertyInfo.
DefaultValue, noAccess));
1800 return GetProperty<P>(propertyInfo, Security.NoAccessBehavior.SuppressException);
1823 return Utilities.CoerceValue<P>(typeof(F),
null, GetProperty<F>(propertyInfo, Security.NoAccessBehavior.SuppressException));
1849 return Utilities.CoerceValue<P>(typeof(F),
null, GetProperty<F>(propertyInfo, noAccess));
1947 var result = valueGenerator();
1961 return LoadManager.IsLoadingProperty(propertyInfo);
1988 LoadPropertyAsync(property, factory);
1993 object IManageProperties.LazyGetProperty<P>(
PropertyInfo<P> propertyInfo, Func<P> valueGenerator)
1995 return LazyGetProperty(propertyInfo, valueGenerator);
1998 object IManageProperties.LazyGetPropertyAsync<P>(
PropertyInfo<P> propertyInfo, Task<P> factory)
2000 return LazyGetPropertyAsync(propertyInfo, factory);
2005#region Read Properties
2022 return Utilities.CoerceValue<P>(typeof(F),
null, ReadProperty<F>(propertyInfo));
2050 result = (P)data.Value;
2072 using (BypassPropertyChecks)
2074 return MethodCaller.CallPropertyGetter(
this, propertyInfo.
Name);
2078 object result =
null;
2082 result = info.
Value;
2106 var result = valueGenerator();
2125 LoadPropertyAsync(property, factory);
2130 P IManageProperties.LazyReadProperty<P>(
PropertyInfo<P> propertyInfo, Func<P> valueGenerator)
2132 return LazyReadProperty(propertyInfo, valueGenerator);
2135 P IManageProperties.LazyReadPropertyAsync<P>(
PropertyInfo<P> propertyInfo, Task<P> factory)
2137 return LazyReadPropertyAsync(propertyInfo, factory);
2142#region Set Properties
2161 SetProperty<P>(propertyInfo.
Name, ref field, newValue, Security.NoAccessBehavior.ThrowException);
2181 SetProperty<P>(propertyName, ref field, newValue, Security.NoAccessBehavior.ThrowException);
2253 protected void SetProperty<P>(
string propertyName, ref P field, P newValue, Security.NoAccessBehavior noAccess)
2257#region Check to see if the property is marked with RelationshipTypes.PrivateField
2266 if (_bypassPropertyChecks ||
CanWriteProperty(propertyInfo, noAccess == Security.NoAccessBehavior.ThrowException))
2268 bool doChange =
false;
2271 if (newValue !=
null)
2276 if (typeof(P) == typeof(
string) && newValue ==
null)
2277 newValue = Utilities.CoerceValue<P>(typeof(
string), field,
string.Empty);
2278 if (!field.Equals(newValue))
2289 catch (System.Security.SecurityException ex)
2297 catch (Exception ex)
2332#region Check to see if the property is marked with RelationshipTypes.PrivateField
2341 if (_bypassPropertyChecks ||
CanWriteProperty(propertyInfo, noAccess == Security.NoAccessBehavior.ThrowException))
2343 bool doChange =
false;
2346 if (newValue !=
null)
2351 if (typeof(V) == typeof(
string) && newValue ==
null)
2352 newValue = Utilities.CoerceValue<V>(typeof(
string),
null,
string.Empty);
2353 if (!field.Equals(newValue))
2359 field = Utilities.CoerceValue<P>(typeof(V), field, newValue);
2364 catch (System.Security.SecurityException ex)
2372 catch (Exception ex)
2375 string.Format(Properties.Resources.PropertyLoadException, propertyName, ex.Message), ex);
2395 SetProperty<P>(propertyInfo, newValue, Security.NoAccessBehavior.ThrowException);
2432 if (_bypassPropertyChecks ||
CanWriteProperty(propertyInfo, noAccess == Security.NoAccessBehavior.ThrowException))
2434 P oldValue =
default(P);
2436 if (fieldData ==
null)
2439 fieldData =
FieldManager.LoadFieldData<P>(propertyInfo, oldValue);
2445 oldValue = fd.Value;
2447 oldValue = (P)fieldData.Value;
2449 if (typeof(F) == typeof(
string) && newValue ==
null)
2450 newValue = Utilities.CoerceValue<F>(typeof(
string),
null,
string.Empty);
2451 LoadPropertyValue<P>(propertyInfo, oldValue, Utilities.CoerceValue<P>(typeof(F), oldValue, newValue), !_bypassPropertyChecks);
2454 catch (System.Security.SecurityException ex)
2462 catch (Exception ex)
2465 string.Format(Properties.Resources.PropertyLoadException, propertyInfo.
Name, ex.Message), ex);
2486 if (_bypassPropertyChecks ||
CanWriteProperty(propertyInfo, noAccess == Security.NoAccessBehavior.ThrowException))
2490 P oldValue =
default(P);
2492 if (fieldData ==
null)
2495 fieldData =
FieldManager.LoadFieldData<P>(propertyInfo, oldValue);
2501 oldValue = fd.Value;
2503 oldValue = (P)fieldData.Value;
2505 if (typeof(P) == typeof(
string) && newValue ==
null)
2506 newValue = Utilities.CoerceValue<P>(typeof(
string),
null,
string.Empty);
2507 LoadPropertyValue<P>(propertyInfo, oldValue, newValue, !_bypassPropertyChecks);
2509 catch (Exception ex)
2512 string.Format(Properties.Resources.PropertyLoadException, propertyInfo.
Name, ex.Message), ex);
2541 catch (System.Security.SecurityException ex)
2549 catch (Exception ex)
2579#region Load Properties
2599 P oldValue =
default(P);
2601 if (fieldData ==
null)
2604 fieldData =
FieldManager.LoadFieldData<P>(propertyInfo, oldValue);
2610 oldValue = fd.Value;
2612 oldValue = (P)fieldData.Value;
2614 LoadPropertyValue<P>(propertyInfo, oldValue, Utilities.CoerceValue<P>(typeof(F), oldValue, newValue),
false);
2616 catch (Exception ex)
2619 string.Format(Properties.Resources.PropertyLoadException, propertyInfo.
Name, ex.Message), ex);
2623 void Core.IManageProperties.LoadProperty<P>(
PropertyInfo<P> propertyInfo, P newValue)
2625 LoadProperty<P>(propertyInfo, newValue);
2628 bool Core.IManageProperties.FieldExists(Core.IPropertyInfo property)
2654 P oldValue =
default(P);
2656 if (fieldData ==
null)
2659 fieldData =
FieldManager.LoadFieldData<P>(propertyInfo, oldValue);
2665 oldValue = fd.Value;
2667 oldValue = (P)fieldData.Value;
2669 LoadPropertyValue<P>(propertyInfo, oldValue, newValue,
false);
2671 catch (Exception ex)
2674 string.Format(Properties.Resources.PropertyLoadException, propertyInfo.
Name, ex.Message), ex);
2699 P oldValue =
default(P);
2701 if (fieldData ==
null)
2704 fieldData =
FieldManager.LoadFieldData<P>(propertyInfo, oldValue);
2710 oldValue = fd.Value;
2712 oldValue = (P)fieldData.Value;
2715 var valuesDiffer = ValuesDiffer(propertyInfo, newValue, oldValue);
2729 ResetChildEditLevel(newValue);
2734 ResetChildEditLevel(newValue);
2741 return valuesDiffer;
2743 catch (Exception ex)
2745 throw new PropertyLoadException(
string.Format(Properties.Resources.PropertyLoadException, propertyInfo.
Name, ex.Message), ex);
2757 private static bool ValuesDiffer<P>(
PropertyInfo<P> propertyInfo, P newValue, P oldValue)
2759 var valuesDiffer =
false;
2760 if (oldValue ==
null)
2761 valuesDiffer = newValue !=
null;
2767 valuesDiffer = !(ReferenceEquals(oldValue, newValue));
2771 valuesDiffer = !(oldValue.Equals(newValue));
2774 return valuesDiffer;
2777 private void LoadPropertyValue<P>(PropertyInfo<P> propertyInfo, P oldValue, P newValue,
bool markDirty)
2779 var valuesDiffer = ValuesDiffer(propertyInfo, newValue, oldValue);
2784 IBusinessObject old = oldValue as IBusinessObject;
2787 IBusinessObject @
new = newValue as IBusinessObject;
2792 if (typeof(IEditableBusinessObject).IsAssignableFrom(propertyInfo.Type))
2804 ResetChildEditLevel(newValue);
2806 else if (typeof(IEditableCollection).IsAssignableFrom(propertyInfo.Type))
2818 ResetChildEditLevel(newValue);
2861 if (propertyInfo.
Type == typeof(
int?))
2865 else if (propertyInfo.
Type == typeof(
bool?))
2873 else if (propertyInfo.
Type == typeof(decimal?))
2877 else if (propertyInfo.
Type == typeof(
double?))
2881 else if (propertyInfo.
Type == typeof(
long?))
2885 else if (propertyInfo.
Type == typeof(
byte?))
2889 else if (propertyInfo.
Type == typeof(
char?))
2893 else if (propertyInfo.
Type == typeof(
short?))
2897 else if (propertyInfo.
Type == typeof(uint?))
2901 else if (propertyInfo.
Type == typeof(ulong?))
2905 else if (propertyInfo.
Type == typeof(ushort?))
2911 return (
bool)LoadPropertyByReflection(
"LoadPropertyMarkDirty", propertyInfo, newValue);
2914 return (
bool)LoadPropertyByReflection(
"LoadPropertyMarkDirty", propertyInfo, newValue);
2937 if (propertyInfo.
Type == typeof(
int?))
2941 else if (propertyInfo.
Type == typeof(
bool?))
2949 else if (propertyInfo.
Type == typeof(decimal?))
2953 else if (propertyInfo.
Type == typeof(
double?))
2957 else if (propertyInfo.
Type == typeof(
long?))
2961 else if (propertyInfo.
Type == typeof(
byte?))
2965 else if (propertyInfo.
Type == typeof(
char?))
2969 else if (propertyInfo.
Type == typeof(
short?))
2973 else if (propertyInfo.
Type == typeof(uint?))
2977 else if (propertyInfo.
Type == typeof(ulong?))
2981 else if (propertyInfo.
Type == typeof(ushort?))
2987 LoadPropertyByReflection(
"LoadProperty", propertyInfo, newValue);
2990 LoadPropertyByReflection(
"LoadProperty", propertyInfo, newValue);
3004 private object LoadPropertyByReflection(
string loadPropertyMethodName,
IPropertyInfo propertyInfo,
object newValue)
3006 var t = this.GetType();
3007 var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
3008 var method = t.GetMethods(flags).FirstOrDefault(c => c.Name == loadPropertyMethodName && c.IsGenericMethod);
3009 var gm = method.MakeGenericMethod(propertyInfo.
Type);
3010 var p =
new object[] { propertyInfo, newValue };
3011 return gm.Invoke(
this, p);
3019 private void ResetChildEditLevel(
object newValue)
3021 IEditableBusinessObject child = newValue as IEditableBusinessObject;
3024 child.SetParent(
this);
3028 child.EditLevelAdded = this.EditLevel;
3032 IEditableCollection col = newValue as IEditableCollection;
3035 col.SetParent(
this);
3036 IUndoableObject undo = col as IUndoableObject;
3049 private AsyncLoadManager _loadManager;
3050 internal AsyncLoadManager LoadManager
3054 if (_loadManager ==
null)
3057 _loadManager.BusyChanged += loadManager_BusyChanged;
3058 _loadManager.UnhandledAsyncException += loadManager_UnhandledAsyncException;
3060 return _loadManager;
3064 private void loadManager_UnhandledAsyncException(
object sender, ErrorEventArgs e)
3069 private void loadManager_BusyChanged(
object sender, BusyChangedEventArgs e)
3082 LoadManager.BeginLoad(
new TaskLoader<R>(property, factory));
3087#region IsBusy / IsIdle
3091 private bool _isBusy;
3097 [EditorBrowsable(EditorBrowsableState.Advanced)]
3111 [EditorBrowsable(EditorBrowsableState.Advanced)]
3124 [Display(AutoGenerateField =
false)]
3125 [ScaffoldColumn(
false)]
3136 [Display(AutoGenerateField =
false)]
3137 [ScaffoldColumn(
false)]
3162 if (_busyChanged !=
null)
3163 _busyChanged(
this, args);
3196#region INotifyUnhandledAsyncException Members
3200 private EventHandler<ErrorEventArgs> _unhandledAsyncException;
3208 add { _unhandledAsyncException = (EventHandler<ErrorEventArgs>)Delegate.Combine(_unhandledAsyncException, value); }
3209 remove { _unhandledAsyncException = (EventHandler<ErrorEventArgs>)Delegate.Remove(_unhandledAsyncException, value); }
3216 [EditorBrowsable(EditorBrowsableState.Advanced)]
3219 if (_unhandledAsyncException !=
null)
3220 _unhandledAsyncException(
this, error);
3229 [EditorBrowsable(EditorBrowsableState.Advanced)]
3237#region Child Change Notification
3246 [System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Design",
3247 "CA1062:ValidateArgumentsOfPublicMethods")]
3253 System.Delegate.Combine(_childChangedHandlers, value);
3258 System.Delegate.Remove(_childChangedHandlers, value);
3269 [EditorBrowsable(EditorBrowsableState.Advanced)]
3272 if (_childChangedHandlers !=
null)
3273 _childChangedHandlers.Invoke(
this, e);
3290 private void RaiseChildChanged(
3291 object childObject, PropertyChangedEventArgs propertyArgs)
3293 ChildChangedEventArgs args =
new ChildChangedEventArgs(childObject, propertyArgs);
3300 private void RaiseChildChanged(
3301 object childObject, PropertyChangedEventArgs propertyArgs, ListChangedEventArgs listArgs)
3303 ChildChangedEventArgs args =
new ChildChangedEventArgs(childObject, propertyArgs, listArgs);
3310 private void RaiseChildChanged(
3311 object childObject, PropertyChangedEventArgs propertyArgs, NotifyCollectionChangedEventArgs listArgs)
3313 ChildChangedEventArgs args =
new ChildChangedEventArgs(childObject, propertyArgs, listArgs);
3322 private void Child_PropertyChanged(
object sender, PropertyChangedEventArgs e)
3327 if (!(e is MetaPropertyChangedEventArgs))
3329 RaiseChildChanged(sender, e);
3338 private void Child_ListChanged(
object sender, ListChangedEventArgs e)
3340 if (e.ListChangedType != ListChangedType.ItemChanged)
3341 RaiseChildChanged(sender,
null, e);
3349 private void Child_CollectionChanged(
object sender, NotifyCollectionChangedEventArgs e)
3351 RaiseChildChanged(sender,
null, e);
3359 private void Child_Changed(
object sender, ChildChangedEventArgs e)
3361 RaiseChildChanged(e);
3366#region Field Manager
3378 if (_fieldManager ==
null)
3383 return _fieldManager;
3389 private void FieldDataDeserialized()
3398 child.SetParent(
this);
3400 if (item is IEditableCollection childCollection)
3402 childCollection.SetParent(
this);
3417 [EditorBrowsable(EditorBrowsableState.Advanced)]
3429 void IParent.RemoveChild(IEditableBusinessObject child)
3437 get {
return this.
Parent; }
3442#region IDataPortalTarget Members
3496#region IManageProperties Members
3498 bool IManageProperties.HasManagedProperties
3500 get {
return (_fieldManager !=
null && _fieldManager.
HasFields); }
3503 List<IPropertyInfo> IManageProperties.GetManagedProperties()
3508 object IManageProperties.GetProperty(IPropertyInfo propertyInfo)
3513 object IManageProperties.ReadProperty(IPropertyInfo propertyInfo)
3518 P IManageProperties.ReadProperty<P>(PropertyInfo<P> propertyInfo)
3523 void IManageProperties.SetProperty(IPropertyInfo propertyInfo,
object newValue)
3528 void IManageProperties.LoadProperty(IPropertyInfo propertyInfo,
object newValue)
3533 bool IManageProperties.LoadPropertyMarkDirty(IPropertyInfo propertyInfo,
object newValue)
3538 List<object> IManageProperties.GetChildren()
3544#region MobileFormatter
3556 [EditorBrowsable(EditorBrowsableState.Advanced)]
3559 base.OnGetState(info, mode);
3560 info.AddValue(
"Csla.Core.BusinessBase._isNew", _isNew);
3561 info.AddValue(
"Csla.Core.BusinessBase._isDeleted", _isDeleted);
3562 info.AddValue(
"Csla.Core.BusinessBase._isDirty", _isDirty);
3563 info.AddValue(
"Csla.Core.BusinessBase._neverCommitted", _neverCommitted);
3564 info.AddValue(
"Csla.Core.BusinessBase._disableIEditableObject", _disableIEditableObject);
3565 info.AddValue(
"Csla.Core.BusinessBase._isChild", _isChild);
3566 info.AddValue(
"Csla.Core.BusinessBase._editLevelAdded", _editLevelAdded);
3567 info.AddValue(
"Csla.Core.BusinessBase._identity", _identity);
3580 [EditorBrowsable(EditorBrowsableState.Advanced)]
3583 base.OnSetState(info, mode);
3584 _isNew = info.GetValue<
bool>(
"Csla.Core.BusinessBase._isNew");
3585 _isDeleted = info.GetValue<
bool>(
"Csla.Core.BusinessBase._isDeleted");
3586 _isDirty = info.GetValue<
bool>(
"Csla.Core.BusinessBase._isDirty");
3587 _neverCommitted = info.GetValue<
bool>(
"Csla.Core.BusinessBase._neverCommitted");
3588 _disableIEditableObject = info.GetValue<
bool>(
"Csla.Core.BusinessBase._disableIEditableObject");
3589 _isChild = info.GetValue<
bool>(
"Csla.Core.BusinessBase._isChild");
3591 _editLevelAdded = info.GetValue<
int>(
"Csla.Core.BusinessBase._editLevelAdded");
3592 _identity = info.GetValue<
int>(
"Csla.Core.BusinessBase._identity");
3606 [EditorBrowsable(EditorBrowsableState.Advanced)]
3610 base.OnGetChildren(info, formatter);
3612 if (_fieldManager !=
null)
3614 var fieldManagerInfo = formatter.SerializeObject(_fieldManager);
3615 info.AddChild(
"_fieldManager", fieldManagerInfo.ReferenceId);
3618 if (_businessRules !=
null)
3620 var vrInfo = formatter.SerializeObject(_businessRules);
3621 info.AddChild(
"_businessRules", vrInfo.ReferenceId);
3636 [EditorBrowsable(EditorBrowsableState.Advanced)]
3639 if (info.Children.ContainsKey(
"_fieldManager"))
3641 var childData = info.Children[
"_fieldManager"];
3645 if (info.Children.ContainsKey(
"_businessRules"))
3647 int refId = info.Children[
"_businessRules"].ReferenceId;
3656#region Property Checks ByPass
3660 private bool _bypassPropertyChecks =
false;
3665 protected internal bool IsBypassingPropertyChecks {
get {
return _bypassPropertyChecks; } }
3669 private BypassPropertyChecksObject _bypassPropertyChecksObject =
null;
3677 [DebuggerBrowsable(DebuggerBrowsableState.Never)]
3678 protected internal BypassPropertyChecksObject BypassPropertyChecks
3682 return BypassPropertyChecksObject.GetManager(
this);
3692 [EditorBrowsable(EditorBrowsableState.Never)]
3693 protected internal class BypassPropertyChecksObject : IDisposable
3696 private static object _lock =
new object();
3698 internal BypassPropertyChecksObject(
BusinessBase businessObject)
3700 _businessObject = businessObject;
3701 _businessObject._bypassPropertyChecks =
true;
3704#region IDisposable Members
3709 public void Dispose()
3712 GC.SuppressFinalize(
this);
3719 protected virtual void Dispose(
bool dispose)
3729 public static BypassPropertyChecksObject GetManager(
BusinessBase businessObject)
3733 if (businessObject._bypassPropertyChecksObject ==
null)
3734 businessObject._bypassPropertyChecksObject =
new BypassPropertyChecksObject(businessObject);
3736 businessObject._bypassPropertyChecksObject.AddRef();
3738 return businessObject._bypassPropertyChecksObject;
3741#region Reference counting
3743 private int _refCount;
3751 get {
return _refCount; }
3754 private void AddRef()
3759 private void DeRef()
3767 _businessObject._bypassPropertyChecks =
false;
3768 _businessObject._bypassPropertyChecksObject =
null;
3769 _businessObject =
null;
3780#region ISuppressRuleChecking Members
3785 void ICheckRules.SuppressRuleChecking()
3793 void ICheckRules.ResumeRuleChecking()
3801 void ICheckRules.CheckRules()
3809 Task ICheckRules.CheckRulesAsync()
Provides consistent context information between the client and server DataPortal objects.
static PropertyChangedModes PropertyChangedMode
Gets or sets a value specifying how CSLA .NET should raise PropertyChanged events.
PropertyChangedModes
Enum representing the way in which CSLA .NET should raise PropertyChanged events.
IPrincipal User
Get or set the current IPrincipal object representing the user's identity.
virtual void OnMetaPropertyChanged(string propertyName)
virtual void OnUnknownPropertyChanged()
Call this method to raise the PropertyChanged event for all object properties.
virtual void OnPropertyChanging(string propertyName)
Call this method to raise the PropertyChanging event for a specific property.
This is the non-generic base class from which most business objects will be derived.
virtual void CheckObjectRules()
Check object rules and notifies UI of properties that may have changed.
virtual void OnBusyChanged(BusyChangedEventArgs args)
Raise the BusyChanged event.
Core.IParent Parent
Provide access to the parent reference for use in child object code.
void AddEventHooks(IBusinessObject child)
For internal use.
virtual bool IsPropertyBusy(Csla.Core.IPropertyInfo property)
Gets a value indicating whether a specific property is busy (has a currently executing async rule).
virtual bool IsSelfValid
Returns true if the object is currently valid, false if the object has broken rules or is otherwise i...
FieldDataManager FieldManager
Gets the PropertyManager object for this business object.
P LazyReadPropertyAsync< P >(PropertyInfo< P > property, Task< P > factory)
Gets a property's value as a specified type.
virtual bool CanExecuteMethod(string methodName)
Returns true if the user is allowed to execute the specified method.
void RemoveEventHooks(IBusinessObject child)
For internal use only.
virtual void Delete()
Marks the object for deletion.
virtual bool IsBusy
Gets a value indicating if this object or its child objects are busy.
virtual void OnUnhandledAsyncException(ErrorEventArgs error)
Raises the UnhandledAsyncException event.
P LazyGetPropertyAsync< P >(PropertyInfo< P > property, Task< P > factory)
Lazily initializes a property and returns the resulting value.
void ApplyEdit()
Commits the current edit process.
virtual bool IsValid
Returns true if the object and its child objects are currently valid, false if the object or any of i...
virtual void EditChildComplete(Core.IEditableBusinessObject child)
Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has comp...
override void OnPropertyChanged(IPropertyInfo propertyInfo)
Call this method to raise the PropertyChanged event for a specific property.
virtual void Child_OnDataPortalInvoke(DataPortalEventArgs e)
Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
bool IsDeleted
Returns true if this object is marked for deletion.
object GetProperty(IPropertyInfo propertyInfo)
Gets a property's value as a specified type.
bool IsPropertyBusy(string propertyName)
Gets a value indicating whether a specific property is busy (has a currently executing async rule).
void MarkAsChild()
Marks the object as being a child object.
static MethodInfo RegisterMethod(Type objectType, string methodName)
Indicates that the specified method belongs to the type.
virtual object GetClone()
Creates a clone of the object.
P LazyGetProperty< P >(PropertyInfo< P > property, Func< P > valueGenerator)
Lazily initializes a property and returns the resulting value.
bool DisableIEditableObject
Gets or sets a value indicating whether the IEditableObject interface methods should be disabled for ...
virtual void AddBusinessRules()
Override this method in your business class to be notified when you need to set up shared business ru...
EventHandler ValidationComplete
Event raised when validation is complete.
void SetPropertyConvert< P, V >(PropertyInfo< P > propertyInfo, ref P field, V newValue)
Sets a property's backing field with the supplied value, first checking authorization,...
virtual void OnRemoveEventHooks(IBusinessObject child)
Unhook child object events.
P LazyReadProperty< P >(PropertyInfo< P > property, Func< P > valueGenerator)
Gets a property's value as a specified type.
virtual void OnErrorsChanged(string propertyName)
Call to indicate that errors have changed for a property.
virtual bool IsSelfBusy
Gets a value indicating if this object is busy.
virtual void OnValidationComplete()
Raises the ValidationComplete event
BusinessRuleManager GetRegisteredRules()
Gets the registered rules.
virtual object ReadProperty(IPropertyInfo propertyInfo)
Gets a property's value.
void SetProperty< P >(PropertyInfo< P > propertyInfo, ref P field, P newValue)
Sets a property's backing field with the supplied value, first checking authorization,...
override void OnSetState(Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
Override this method to retrieve your field values from the MobileFormatter serialzation stream.
virtual void Child_OnDataPortalException(DataPortalEventArgs e, Exception ex)
Called by the server-side DataPortal if an exception occurs during data access.
BrokenRulesCollection GetBrokenRules()
Gets the broken rules for this object
BusinessRules BusinessRules
Provides access to the broken rules functionality.
bool CanExecuteMethod(Csla.Core.IMemberInfo method, bool throwOnFalse)
Returns true if the user is allowed to execute the specified method.
void LoadPropertyAsync< R >(PropertyInfo< R > property, Task< R > factory)
Load a property from an async method.
BusinessBase()
Creates an instance of the type.
virtual void Child_Create()
Override this method to load a new business object with default values from the database.
void MarkDeleted()
Marks an object for deletion.
virtual bool CanExecuteMethod(Csla.Core.IMemberInfo method)
Returns true if the user is allowed to execute the specified method.
void SetPropertyConvert< P, F >(PropertyInfo< P > propertyInfo, F newValue)
Sets a property's managed field with the supplied value, first checking authorization,...
void CancelEdit()
Cancels the current edit process, restoring the object's state to its previous values.
virtual void LoadProperty(IPropertyInfo propertyInfo, object newValue)
Loads a property's managed field with the supplied value.
virtual void OnChildChanged(ChildChangedEventArgs e)
Raises the ChildChanged event, indicating that a child object has been changed.
virtual bool LoadPropertyMarkDirty(IPropertyInfo propertyInfo, object newValue)
Loads a property's managed field with the supplied value.
P ReadPropertyConvert< F, P >(PropertyInfo< F > propertyInfo)
Gets a property's value from the list of managed field values, converting the value to an appropriate...
bool CanReadProperty(string propertyName)
Returns true if the user is allowed to read the specified property.
EventHandler< Csla.Core.ChildChangedEventArgs > ChildChanged
Event raised when a child object has been changed.
bool IsNew
Returns true if this is a new object, false if it is a pre-existing object.
override void OnGetChildren(Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter)
Override this method to insert your child object references into the MobileFormatter serialzation str...
void MarkDirty(bool suppressEvent)
Marks an object as being dirty, or changed.
virtual bool IsSavable
Returns true if this object is both dirty and valid.
BusyChangedEventHandler BusyChanged
Event indicating that the IsBusy property has changed.
virtual void SetParent(Core.IParent parent)
Used by BusinessListBase as a child object is created to tell the child object about its parent.
virtual void MarkOld()
Marks the object as being an old (not new) object.
virtual void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
This method is called on a newly deserialized object after deserialization is complete.
static Csla.Core.IMemberInfo RegisterMethod(Type objectType, IMemberInfo info)
Indicates that the specified method belongs to the type.
virtual bool IsSelfDirty
Returns true if this object's data has been changed.
EventHandler< ErrorEventArgs > UnhandledAsyncException
Event indicating that an exception occurred during the processing of an async operation.
virtual void PropertyHasChanged(Csla.Core.IPropertyInfo property)
Performs processing required when a property has changed.
virtual bool CanWriteProperty(Csla.Core.IPropertyInfo property)
Returns true if the user is allowed to write the specified property.
virtual Rules.BrokenRulesCollection BrokenRulesCollection
Provides access to the readonly collection of broken business rules for this object.
virtual bool CanReadProperty(Csla.Core.IPropertyInfo property)
Returns true if the user is allowed to read the calling property.
override void UndoChangesComplete()
Called when an undo operation has completed.
override void OnApplicationContextSet()
Method invoked after ApplicationContext is available.
void MarkDirty()
Marks an object as being dirty, or changed.
override void AcceptChangesComplete()
Notifies the parent object (if any) that this child object's edits have been accepted.
static PropertyInfo< P > RegisterProperty< P >(Type objectType, PropertyInfo< P > info)
Indicates that the specified property belongs to the type.
virtual void MetaPropertyHasChanged(string name)
Raises OnPropertyChanged for meta properties (IsXYZ) when PropertyChangedMode is not Windows
P GetProperty< P >(string propertyName, P field, P defaultValue)
Gets a property's value, first checking authorization.
virtual void DataPortal_OnDataPortalInvoke(DataPortalEventArgs e)
Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
void LoadPropertyConvert< P, F >(PropertyInfo< P > propertyInfo, F newValue)
Loads a property's managed field with the supplied value.
virtual void DataPortal_OnDataPortalInvokeComplete(DataPortalEventArgs e)
Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
P GetPropertyConvert< F, P >(PropertyInfo< F > propertyInfo, F field)
Gets a property's value as a specified type, first checking authorization.
virtual void OnAddEventHooks(IBusinessObject child)
Hook child object events.
void OnUnhandledAsyncException(object originalSender, Exception error)
Raises the UnhandledAsyncException event.
override void OnGetState(Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
Override this method to insert your field values into the MobileFormatter serialzation stream.
bool LoadPropertyMarkDirty< P >(PropertyInfo< P > propertyInfo, P newValue)
Loads a property's managed field with the supplied value and mark field as dirty if value is modified...
bool IsChild
Returns true if this is a child (non-root) object.
virtual bool IsDirty
Returns true if this object's data, or any of its fields or child objects data, has been changed.
virtual void CheckPropertyRules(IPropertyInfo property)
Check rules for the property and notifies UI of properties that may have changed.
bool CanWriteProperty(Csla.Core.IPropertyInfo property, bool throwOnFalse)
Returns true if the user is allowed to write the calling property.
virtual void Initialize()
Override this method to set up event handlers so user code in a partial class can respond to events r...
virtual void DataPortal_OnDataPortalException(DataPortalEventArgs e, Exception ex)
Called by the server-side DataPortal if an exception occurs during data access.
void MarkClean()
Forces the object's IsDirty flag to false.
void MarkIdle()
Mark the object as not busy (it is not running an async operation).
void MarkBusy()
Mark the object as busy (it is running an async operation).
void BeginEdit()
Starts a nested edit on the object.
void SetProperty(IPropertyInfo propertyInfo, object newValue)
Sets a property's managed field with the supplied value, and then calls PropertyHasChanged if the val...
virtual void Child_OnDataPortalInvokeComplete(DataPortalEventArgs e)
Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
P ReadProperty< P >(PropertyInfo< P > propertyInfo)
Gets a property's value as a specified type.
bool CanWriteProperty(string propertyName)
Returns true if the user is allowed to write the specified property.
bool PropertyIsLoading(IPropertyInfo propertyInfo)
Gets a value indicating whether a lazy loaded property is currently being retrieved.
virtual void MarkNew()
Marks the object as being a new object.
bool CanReadProperty(Csla.Core.IPropertyInfo property, bool throwOnFalse)
Returns true if the user is allowed to read the calling property.
override void OnSetChildren(Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter)
Override this method to retrieve your child object references from the MobileFormatter serialzation s...
Event arguments for the BusyChanged event.
Contains event data about the changed child object.
Event arguments for an unhandled async exception.
Manages properties and property data for a business object.
bool HasFields
Gets a value indicating whether there are any managed fields available.
List< IPropertyInfo > GetRegisteredProperties()
Returns a copy of the property list for the business object.
FieldDataManager()
Creates an instance of the type.
bool IsDirty()
Returns a value indicating whether any fields are dirty.
IFieldData GetFieldData(IPropertyInfo propertyInfo)
Gets the IFieldData object for a specific field.
bool IsValid()
Returns a value indicating whether all fields are valid.
bool FieldExists(IPropertyInfo propertyInfo)
Returns a value indicating whether an IFieldData entry exists for the specified property.
List< object > GetChildren()
Returns a list of all child objects contained in the list of fields.
IPropertyInfo GetRegisteredProperty(string propertyName)
Returns the IPropertyInfo object corresponding to the property name.
Implements n-level undo capabilities as described in Chapters 2 and 3.
bool BindingEdit
Gets or sets a value indicating whether n-level undo was invoked through IEditableObject.
UndoableBase()
Creates an instance of the type.
Provides information about the DataPortal call.
Maintains metadata about a method.
A strongly-typed resource class, for looking up localized strings, etc.
static string PrivateFieldException
Looks up a localized string similar to Properties with private backing fields must be marked as Relat...
static string NoDeleteRootException
Looks up a localized string similar to Invalid for root objects - use Delete instead.
static string PropertySetNotAllowed
Looks up a localized string similar to Property set not allowed.
static string ChildDeleteException
Looks up a localized string similar to Can not directly mark a child object for deletion - use its pa...
static string PropertyLoadException
Looks up a localized string similar to Property load or set failed for property {0} ({1}).
static string PropertyGetNotAllowed
Looks up a localized string similar to Property get not allowed.
static string BusyObjectsMayNotBeMarkedBusy
Looks up a localized string similar to Objects that are marked busy may not be marked busy again.
static string NoSuchMethod
Looks up a localized string similar to No such method {0}.
Maintains metadata about a property.
virtual T DefaultValue
Gets the default initial value for the property.
RelationshipTypes RelationshipType
Gets the relationship between the declaring object and the object reference in the property.
Type Type
Gets the type of the property.
string Name
Gets the property name value.
Exception indicating a failure to set a property's field.
string Description
Provides access to the description of the broken rule.
A collection of currently broken rules.
BrokenRule GetFirstBrokenRule(Csla.Core.IPropertyInfo property)
Returns the first BrokenRule object corresponding to the specified property.
override string ToString()
Returns the text of all broken rule descriptions, each separated by a Environment....
Manages the list of rules for a business type.
Tracks the business rules for a business object.
BusinessRules()
Creates an instance of the type.
List< string > CheckRules()
Invokes all rules for the business type.
override void OnSetChildren(SerializationInfo info, MobileFormatter formatter)
Override this method to retrieve your child object references from the MobileFormatter serialzation s...
async Task< List< string > > CheckRulesAsync(int timeout)
Invokes all rules for the business type.
bool SuppressRuleChecking
Gets or sets a value indicating whether calling CheckRules should result in rule methods being invoke...
bool IsValid
Gets a value indicating whether there are any currently broken rules, which would mean the object is ...
List< string > CheckObjectRules()
Invokes all rules attached at the class level of the business type.
void AddDataAnnotations()
Adds validation rules corresponding to property data annotation attributes.
static bool HasPermission(ApplicationContext applicationContext, AuthorizationActions action, Type objectType)
Checks per-type authorization rules.
bool GetPropertyBusy(Csla.Core.IPropertyInfo property)
Gets a value indicating whether a specific property has any async rules running.
bool RunningAsyncRules
Gets a value indicating whether any async rules are currently executing.
bool CachePermissionResult(AuthorizationActions action, IMemberInfo element)
Gets a value indicating whether the permission result can be cached.
BrokenRulesCollection GetBrokenRules()
Gets the broken rules list.
Object containing the serialization data for a specific object.
object Value
Gets or sets the field value.
This is the core interface implemented by all CSLA .NET base classes.
int Identity
Gets a value representing this object instance's unique identity value within the business object gra...
Defines the common methods for any business object which exposes means to supress and check business ...
Defines the common methods required by all editable CSLA single objects.
Defines the common methods required by all editable CSLA collection objects.
Maintains metadata about a method or property.
string Name
Gets the member name value.
Interface defining an object that notifies when it is busy executing an asynchronous operation.
BusyChangedEventHandler BusyChanged
Event raised when the object's busy status changes.
Implemented by classes that notify when a child object has changed.
EventHandler< ChildChangedEventArgs > ChildChanged
Event indictating that a child object has changed.
Implemented by an object that perfoms asynchronous operations that may raise exceptions.
EventHandler< ErrorEventArgs > UnhandledAsyncException
Event indicating that an exception occurred during an asynchronous operation.
Defines the interface that must be implemented by any business object that contains child objects.
int GetNextIdentity(int current)
Gets and consumes the next available unique identity value for an object instance in the object graph...
void ApplyEditChild(Core.IEditableBusinessObject child)
Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has comp...
void RemoveChild(Core.IEditableBusinessObject child)
This method is called by a child object when it wants to be removed from the collection.
IParent Parent
Provide access to the parent reference for use in child object code.
Maintains metadata about a property.
RelationshipTypes RelationshipType
Gets the relationship between the declaring object and the object reference in the property.
Type Type
Gets the type of the property.
object DefaultValue
Gets the default initial value for the property.
Defines the interaction between the rules engine and a business object that hosts the rules.
void RuleComplete(Csla.Core.IPropertyInfo property)
Indicates that a rule has finished processing.
void RuleStart(Csla.Core.IPropertyInfo property)
Indicates that a rule has started processing.
Defines the authorization interface through which an object can indicate which properties the current...
Interface defining callback methods used by the SerializationFormatterFactory.GetFormatter().
void Deserialized()
Method called on an object after deserialization is complete.
delegate void BusyChangedEventHandler(object sender, BusyChangedEventArgs e)
Delegate for handling the BusyChanged event.
StateMode
Indicates the reason the MobileFormatter functionality has been invoked.
AuthorizationActions
Authorization actions.
RelationshipTypes
List of valid relationship types between a parent object and another object through a managed propert...
@ Serializable
Prevents updating or inserting until the transaction is complete.