CSLA.NET 6.0.0
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
88 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, RelationshipTypes relationship)
89 {
90 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, string.Empty, relationship));
91 }
92
102 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, RelationshipTypes relationship)
103 {
104 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
105 return RegisterProperty<P>(reflectedPropertyInfo.Name, relationship);
106 }
107
116 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, string friendlyName)
117 {
118 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, friendlyName));
119 }
120
129 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, string friendlyName)
130 {
131 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
132 return RegisterProperty<P>(reflectedPropertyInfo.Name, friendlyName);
133 }
134
144 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, string friendlyName, P defaultValue)
145 {
146 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, friendlyName, defaultValue));
147 }
148
158 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, string friendlyName, P defaultValue)
159 {
160 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
161 return RegisterProperty(reflectedPropertyInfo.Name, friendlyName, defaultValue);
162 }
163
175 protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, string friendlyName, P defaultValue, RelationshipTypes relationship)
176 {
177 return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, friendlyName, defaultValue, relationship));
178 }
179
191 protected static PropertyInfo<P> RegisterProperty<P>(Expression<Func<T, object>> propertyLambdaExpression, string friendlyName, P defaultValue, RelationshipTypes relationship)
192 {
193 PropertyInfo reflectedPropertyInfo = Reflect<T>.GetProperty(propertyLambdaExpression);
194 return RegisterProperty(reflectedPropertyInfo.Name, friendlyName, defaultValue, relationship);
195 }
196
197 #endregion
198 }
199}
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.