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.
SingleCriteria.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="SingleCriteria.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>A single-value criteria used to retrieve business</summary>
7//-----------------------------------------------------------------------
8#if !MONO
9using System;
11using Csla.Core;
12
13namespace Csla
14{
23 [Serializable()]
24 [Obsolete("Use custom class derived from CriteriaBase e.g. ProjectCriteria : CriteriaBase<ProjectCriteria> instead.")]
25 public class SingleCriteria<C> : CriteriaBase<SingleCriteria<C>>
26 {
27 private C _value;
28
32 public C Value
33 {
34 get { return _value; }
35 }
36
45 public SingleCriteria(C value)
46 {
47 _value = value;
48 }
49
56#if (ANDROID || IOS) || NETFX_CORE
57 public SingleCriteria()
58 { }
59#else
60 protected SingleCriteria()
61 { }
62#endif
63
72 protected SingleCriteria(Type type, C value)
73 {
74 _value = value;
75 }
76
77 #region MobileFormatter
78
89 protected override void OnGetState(SerializationInfo info, StateMode mode)
90 {
91 base.OnGetState(info, mode);
92 info.AddValue("Csla.Xaml.SingleCriteria._value", _value);
93 }
94
105 protected override void OnSetState(SerializationInfo info, StateMode mode)
106 {
107 base.OnSetState(info, mode);
108 _value = info.GetValue<C>("Csla.Xaml.SingleCriteria._value");
109 }
110
111 #endregion
112 }
113
125 [Serializable()]
126 [Obsolete("Use custom class derived from CriteriaBase e.g. ProjectCriteria : CriteriaBase<ProjectCriteria> instead.")]
127 public class SingleCriteria<B, C> : SingleCriteria<C>
128 {
137 public SingleCriteria(C value)
138 : base(typeof(B), value)
139 { }
140
147#if (ANDROID || IOS) || NETFX_CORE
148 public SingleCriteria()
149 { }
150#else
151 protected SingleCriteria()
152 { }
153#endif
154 }
155}
156#endif
Object containing the serialization data for a specific object.
void AddValue(string name, object value)
Adds a value to the serialization stream.
A single-value criteria used to retrieve business objects that only require one criteria value.
SingleCriteria(C value)
Creates an instance of the type, initializing it with the criteria value.
SingleCriteria(Type type, C value)
Creates an instance of the type.
C Value
Gets the criteria value provided by the caller.
override void OnGetState(SerializationInfo info, StateMode mode)
Override this method to insert your field values into the MobileFormatter serialzation stream.
SingleCriteria()
Creates an instance of the type.
override void OnSetState(SerializationInfo info, StateMode mode)
Override this method to retrieve your field values from the MobileFormatter serialzation stream.
StateMode
Indicates the reason the MobileFormatter functionality has been invoked.
Definition: StateMode.cs:20
@ Serializable
Prevents updating or inserting until the transaction is complete.