CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ReadOnlyListBase.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ReadOnlyListBase.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>This is the base class from which readonly collections</summary>
7//-----------------------------------------------------------------------
8using System.Collections.Generic;
9using System.ComponentModel;
10using System.Diagnostics.CodeAnalysis;
11using Csla.Properties;
12using System;
13
14namespace Csla
15{
22 [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
24 public abstract class ReadOnlyListBase<T, C> :
25#if (ANDROID || IOS) || NETFX_CORE
26 Core.ReadOnlyBindingList<C>,
27#else
28 Core.ReadOnlyObservableBindingList<C>,
29#endif
30 Csla.Core.IReadOnlyCollection,
31 ICloneable, Server.IDataPortalTarget,
33 where T : ReadOnlyListBase<T, C>
34 {
38 protected ReadOnlyListBase()
39 {
40 Initialize();
41 }
42
43 #region Initialize
44
50 protected virtual void Initialize()
51 { /* allows subclass to initialize events before any other activity occurs */ }
52
53 #endregion
54
55 #region Identity
56
57 int Core.IBusinessObject.Identity
58 {
59 get { return 0; }
60 }
61
62 #endregion
63
64 #region ICloneable
65
66 object ICloneable.Clone()
67 {
68 return GetClone();
69 }
74 [EditorBrowsable(EditorBrowsableState.Advanced)]
75 protected virtual object GetClone()
76 {
77 return Core.ObjectCloner.Clone(this);
78 }
79
86 public T Clone()
87 {
88 return (T)GetClone();
89 }
90
91 #endregion
92
93 #region ToArray
94
98 public C[] ToArray()
99 {
100 return new List<C>(this).ToArray();
101 }
102 #endregion
103
104 #region Data Access
105
106 private void DataPortal_Update()
107 {
108 throw new NotSupportedException(Resources.UpdateNotSupportedException);
109 }
110
111 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "criteria")]
112 [Delete]
113 private void DataPortal_Delete(object criteria)
114 {
115 throw new NotSupportedException(Resources.DeleteNotSupportedException);
116 }
117
123 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
124 [EditorBrowsable(EditorBrowsableState.Advanced)]
126 {
127
128 }
129
135 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
136 [EditorBrowsable(EditorBrowsableState.Advanced)]
138 {
139
140 }
141
148 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
149 [EditorBrowsable(EditorBrowsableState.Advanced)]
150 protected virtual void DataPortal_OnDataPortalException(DataPortalEventArgs e, Exception ex)
151 {
152
153 }
154
160 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
161 [EditorBrowsable(EditorBrowsableState.Advanced)]
163 {
164 }
165
171 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
172 [EditorBrowsable(EditorBrowsableState.Advanced)]
174 {
175 }
176
183 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
184 [EditorBrowsable(EditorBrowsableState.Advanced)]
185 protected virtual void Child_OnDataPortalException(DataPortalEventArgs e, Exception ex)
186 {
187 }
188
189 #endregion
190
191 #region IDataPortalTarget Members
192
193 void Csla.Server.IDataPortalTarget.CheckRules()
194 { }
195
196 void Csla.Server.IDataPortalTarget.MarkAsChild()
197 { }
198
199 void Csla.Server.IDataPortalTarget.MarkNew()
200 { }
201
202 void Csla.Server.IDataPortalTarget.MarkOld()
203 { }
204
205 void Csla.Server.IDataPortalTarget.DataPortal_OnDataPortalInvoke(DataPortalEventArgs e)
206 {
208 }
209
210 void Csla.Server.IDataPortalTarget.DataPortal_OnDataPortalInvokeComplete(DataPortalEventArgs e)
211 {
213 }
214
215 void Csla.Server.IDataPortalTarget.DataPortal_OnDataPortalException(DataPortalEventArgs e, Exception ex)
216 {
218 }
219
220 void Csla.Server.IDataPortalTarget.Child_OnDataPortalInvoke(DataPortalEventArgs e)
221 {
223 }
224
225 void Csla.Server.IDataPortalTarget.Child_OnDataPortalInvokeComplete(DataPortalEventArgs e)
226 {
228 }
229
230 void Csla.Server.IDataPortalTarget.Child_OnDataPortalException(DataPortalEventArgs e, Exception ex)
231 {
232 this.Child_OnDataPortalException(e, ex);
233 }
234
235 #endregion
236 }
237}
Provides information about the DataPortal call.
A strongly-typed resource class, for looking up localized strings, etc.
static string DeleteNotSupportedException
Looks up a localized string similar to Invalid operation - delete not allowed.
static string UpdateNotSupportedException
Looks up a localized string similar to Invalid operation - update not allowed.
This is the base class from which readonly collections of readonly objects should be derived.
C[] ToArray()
Get an array containing all items in the list.
virtual object GetClone()
Creates a clone of the object.
ReadOnlyListBase()
Creates an instance of the object.
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 Child_OnDataPortalInvoke(DataPortalEventArgs e)
Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
virtual void DataPortal_OnDataPortalException(DataPortalEventArgs e, Exception ex)
Called by the server-side DataPortal if an exception occurs during data access.
virtual void DataPortal_OnDataPortalInvoke(DataPortalEventArgs e)
Called by the server-side DataPortal prior to calling the requested DataPortal_xyz method.
virtual void Child_OnDataPortalInvokeComplete(DataPortalEventArgs e)
Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
virtual void Child_OnDataPortalException(DataPortalEventArgs e, Exception ex)
Called by the server-side DataPortal if an exception occurs during data access.
virtual void DataPortal_OnDataPortalInvokeComplete(DataPortalEventArgs e)
Called by the server-side DataPortal after calling the requested DataPortal_xyz method.
T Clone()
Creates a clone of the object.
This is the base class from which readonly collections of readonly objects should be derived.
@ Serializable
Prevents updating or inserting until the transaction is complete.