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.
ReadOnlyBindingListBase.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ReadOnlyBindingListBase.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//-----------------------------------------------------------------------
8#if NETFX_CORE
9using System;
10
11namespace Csla
12{
20 public abstract class ReadOnlyBindingListBase<T, C> : ReadOnlyListBase<T, C>
21 where T : ReadOnlyBindingListBase<T, C>
22 { }
23}
24#else
25using System;
26using System.Collections.Generic;
27using System.ComponentModel;
28using System.Linq.Expressions;
29using Csla.Properties;
30
31namespace Csla
32{
39 [System.Diagnostics.CodeAnalysis.SuppressMessage(
40 "Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
41 [Serializable()]
42 public abstract class ReadOnlyBindingListBase<T, C> :
43 Core.ReadOnlyBindingList<C>, Csla.Core.IReadOnlyCollection,
44 ICloneable, Server.IDataPortalTarget
45 where T : ReadOnlyBindingListBase<T, C>
46 {
47
52 {
53 Initialize();
54 }
55
56#region Initialize
57
63 protected virtual void Initialize()
64 { /* allows subclass to initialize events before any other activity occurs */ }
65
66#endregion
67
68#region ICloneable
69
70 object ICloneable.Clone()
71 {
72 return GetClone();
73 }
78 [EditorBrowsable(EditorBrowsableState.Advanced)]
79 protected virtual object GetClone()
80 {
81 return Core.ObjectCloner.Clone(this);
82 }
83
90 public T Clone()
91 {
92 return (T)GetClone();
93 }
94
95#endregion
96
97#region Data Access
98
99 private void DataPortal_Update()
100 {
101 throw new NotSupportedException(Resources.UpdateNotSupportedException);
102 }
103
104 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "criteria")]
105 [Delete]
106 private void DataPortal_Delete(object criteria)
107 {
108 throw new NotSupportedException(Resources.DeleteNotSupportedException);
109 }
110
116 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
117 [EditorBrowsable(EditorBrowsableState.Advanced)]
119 {
120
121 }
122
128 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
129 [EditorBrowsable(EditorBrowsableState.Advanced)]
131 {
132
133 }
134
141 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
142 [EditorBrowsable(EditorBrowsableState.Advanced)]
143 protected virtual void DataPortal_OnDataPortalException(DataPortalEventArgs e, Exception ex)
144 {
145
146 }
147
153 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
154 [EditorBrowsable(EditorBrowsableState.Advanced)]
156 {
157 }
158
164 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
165 [EditorBrowsable(EditorBrowsableState.Advanced)]
167 {
168 }
169
176 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
177 [EditorBrowsable(EditorBrowsableState.Advanced)]
178 protected virtual void Child_OnDataPortalException(DataPortalEventArgs e, Exception ex)
179 {
180 }
181
182#endregion
183
184#region ToArray
185
189 public C[] ToArray()
190 {
191 List<C> result = new List<C>();
192 foreach (C item in this)
193 result.Add(item);
194 return result.ToArray();
195 }
196#endregion
197
198#region IDataPortalTarget Members
199
200 void Csla.Server.IDataPortalTarget.CheckRules()
201 { }
202
203 void Csla.Server.IDataPortalTarget.MarkAsChild()
204 { }
205
206 void Csla.Server.IDataPortalTarget.MarkNew()
207 { }
208
209 void Csla.Server.IDataPortalTarget.MarkOld()
210 { }
211
212 void Csla.Server.IDataPortalTarget.DataPortal_OnDataPortalInvoke(DataPortalEventArgs e)
213 {
215 }
216
217 void Csla.Server.IDataPortalTarget.DataPortal_OnDataPortalInvokeComplete(DataPortalEventArgs e)
218 {
220 }
221
222 void Csla.Server.IDataPortalTarget.DataPortal_OnDataPortalException(DataPortalEventArgs e, Exception ex)
223 {
225 }
226
227 void Csla.Server.IDataPortalTarget.Child_OnDataPortalInvoke(DataPortalEventArgs e)
228 {
230 }
231
232 void Csla.Server.IDataPortalTarget.Child_OnDataPortalInvokeComplete(DataPortalEventArgs e)
233 {
235 }
236
237 void Csla.Server.IDataPortalTarget.Child_OnDataPortalException(DataPortalEventArgs e, Exception ex)
238 {
239 this.Child_OnDataPortalException(e, ex);
240 }
241
242#endregion
243 }
244}
245#endif
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.
T Clone()
Creates a clone of the object.
C[] ToArray()
Get an array containing all items in the list.
virtual object GetClone()
Creates a clone of the object.
virtual void Child_OnDataPortalInvokeComplete(DataPortalEventArgs e)
Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
virtual void DataPortal_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_OnDataPortalInvoke(DataPortalEventArgs e)
Called by the server-side DataPortal prior to calling the requested DataPortal_xyz method.
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.
ReadOnlyBindingListBase()
Creates an instance of the object.
virtual void Child_OnDataPortalInvoke(DataPortalEventArgs e)
Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
@ Serializable
Prevents updating or inserting until the transaction is complete.