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.
CriteriaBase.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CriteriaBase.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Base type from which Criteria classes can be</summary>
7//-----------------------------------------------------------------------
8using System;
10using Csla.Core;
11using System.ComponentModel;
12using System.Linq.Expressions;
13using Csla.Reflection;
14using System.Reflection;
15
16namespace Csla
17{
23 public abstract class CriteriaBase<T> : ManagedObjectBase
24 where T : CriteriaBase<T>
25 {
31 protected CriteriaBase()
32 { }
33
34 #region Register Properties
35
50 {
51 return Core.FieldManager.PropertyInfoManager.RegisterProperty<P>(typeof(T), info);
52 }
53
61 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName)
62 {
63 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName));
64 }
65
73 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression)
74 {
75 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
76 return RegisterProperty<P>(reflectedPropertyInfo.Name);
77 }
78
87 [Obsolete]
88 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, P defaultValue)
89 {
90 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
91
92 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), reflectedPropertyInfo.Name, reflectedPropertyInfo.Name, defaultValue));
93 }
94
104 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, RelationshipTypes relationship)
105 {
106 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, string.Empty, relationship));
107 }
108
118 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, RelationshipTypes relationship)
119 {
120 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
121 return RegisterProperty<P>(reflectedPropertyInfo.Name, relationship);
122 }
123
132 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, string friendlyName)
133 {
134 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, friendlyName));
135 }
136
145 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, string friendlyName)
146 {
147 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
148 return RegisterProperty<P>(reflectedPropertyInfo.Name, friendlyName);
149 }
150
161 [Obsolete]
162 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, string friendlyName, RelationshipTypes relationship)
163 {
164 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
165
166 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), reflectedPropertyInfo.Name, friendlyName, relationship));
167 }
168
178 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, string friendlyName, P defaultValue)
179 {
180 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, friendlyName, defaultValue));
181 }
182
192 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, string friendlyName, P defaultValue)
193 {
194 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
195 return RegisterProperty(reflectedPropertyInfo.Name, friendlyName, defaultValue);
196 }
197
209 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, string friendlyName, P defaultValue, RelationshipTypes relationship)
210 {
211 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, friendlyName, defaultValue, relationship));
212 }
213
225 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, string friendlyName, P defaultValue, RelationshipTypes relationship)
226 {
227 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
228 return RegisterProperty(reflectedPropertyInfo.Name, friendlyName, defaultValue, relationship);
229 }
230
231 #endregion
232 }
233}
Base class for an object that is serializable using SerializationFormatterFactory....
Base type from which Criteria classes can be derived in a business class.
Definition: CriteriaBase.cs:25
static PropertyInfo< P > RegisterProperty< P >(PropertyInfo< P > info)
Indicates that the specified property belongs to the business object type.
Definition: CriteriaBase.cs:49
CriteriaBase()
Initializes empty CriteriaBase.
Definition: CriteriaBase.cs:31
Maintains metadata about a property.
string Name
Gets the property name value.
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.