本文整理汇总了C#中IClassDef.GetPropDef方法的典型用法代码示例。如果您正苦于以下问题:C# IClassDef.GetPropDef方法的具体用法?C# IClassDef.GetPropDef怎么用?C# IClassDef.GetPropDef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IClassDef
的用法示例。
在下文中一共展示了IClassDef.GetPropDef方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropDefByPropName
/// <summary>
/// Finds the property definition with the given name for the specified
/// class definition. This method will search through an inheritance
/// structure or relationship if needed.
/// </summary>
/// <param name="classDef">The class definition containing either the property
/// or containing inheritance or relationship structures that might hold
/// the property</param>
/// <param name="propertyName">The name of the property. A related property can
/// be described by "RelationshipName.PropertyName".</param>
/// <returns></returns>
public static IPropDef GetPropDefByPropName(IClassDef classDef, string propertyName)
{
if (classDef == null || IsReflectiveProperty(propertyName))
{
return null;
}
/* if (IsRelatedProperty(propertyName))
{
string relationshipName = propertyName.Substring(0, propertyName.IndexOf("."));
propertyName = propertyName.Remove(0, propertyName.IndexOf(".") + 1);
List<string> relNames = new List<string>();
relNames.AddRange(relationshipName.Split(new[]{"|"}, StringSplitOptions.RemoveEmptyEntries));
IRelationshipDefCol relationshipDefCol = classDef.RelationshipDefCol;
IPropDef propDef = null;
foreach (string relName in relNames)
{
if (relationshipDefCol.Contains(relName))
{
IRelationshipDef relationshipDef = relationshipDefCol[relName];
IClassDef relatedClassDef = relationshipDef.RelatedObjectClassDef;
propDef = GetPropDefByPropName(relatedClassDef, propertyName);
}
if (propDef != null)
{
return propDef;
}
}
return null;
}*/
return classDef.GetPropDef(propertyName, false);
}
示例2: GetPropDef
private static IPropDef GetPropDef(IClassDef classDef, IUIGridColumn gridColumn)
{
/* IPropDef propDef = null;
if (classDef.PropDefColIncludingInheritance.Contains(gridColumn.PropertyName))
{
propDef = classDef.PropDefColIncludingInheritance[gridColumn.PropertyName];
}*/
return classDef.GetPropDef(gridColumn.PropertyName, false);
}
示例3: GetPropDef
protected static ISingleValueDef GetPropDef(IClassDef classDef, string propName, bool raiseErrIfNotExists)
{
ISingleValueDef def = classDef.GetPropDef(propName, false);
if (raiseErrIfNotExists) ValidateProp(classDef.ClassType, def, propName);
return def;
}
示例4: GetPropDef
private static IPropDef GetPropDef(IClassDef classDef, IUIGridColumn gridColumn)
{
IPropDef propDef = classDef.GetPropDef(gridColumn.PropertyName, false);
return propDef;
}
示例5: PrepareField
///<summary>
/// Prepares
///</summary>
///<param name="currentSource"></param>
///<param name="classDef"></param>
///<param name="field"></param>
///<returns></returns>
public static IPropDef PrepareField(Source currentSource, IClassDef classDef, QueryField field)
{
IClassDef classDefOfField = classDef;
if (classDef.IsUsingClassTableInheritance())
classDefOfField = classDef.GetPropDef(field.PropertyName).ClassDef;
IClassDef fieldClassDef;
PrepareSource(classDefOfField, ref currentSource, out fieldClassDef);
field.Source = currentSource;
if (fieldClassDef != null)
return fieldClassDef.GetPropDef(field.PropertyName);
return null;
}
示例6: CreateOrderCriteria
///<summary>
/// Based on the class definition and the orderByString an <see cref="OrderCriteria"/> object is created.
/// The orderCriteria object is a set of order by fields including information on their
/// business object properties and their dataSource.
///</summary>
///<param name="classDef">The class definition to use for building the order criteria</param>
///<param name="orderByString">The orderby string to use for creating the <see cref="OrderCriteria"/>.</param>
///<returns>the newly created <see cref="OrderCriteria"/> object.</returns>
public static IOrderCriteria CreateOrderCriteria(IClassDef classDef, string orderByString)
{
if (classDef == null) throw new ArgumentNullException("classDef");
IOrderCriteria orderCriteria = OrderCriteria.FromString(orderByString);
try
{
//TODO Mark 20 Mar 2009: Souldn't the following code be stripped out into a PrepareOrderBy method that is called before loading? (Similar to PrepareCriteria)
foreach (OrderCriteriaField field in orderCriteria.Fields)
{
Source source = field.Source;
IClassDef relatedClassDef;
IClassDef classDefOfField = classDef;
if (classDef.IsUsingClassTableInheritance())
classDefOfField = classDef.GetPropDef(field.PropertyName).ClassDef;
PrepareSource(classDefOfField, ref source, out relatedClassDef);
field.Source = source;
IPropDef propDef = relatedClassDef.GetPropDef(field.PropertyName);
field.FieldName = propDef.DatabaseFieldName;
field.Source.ChildSourceLeaf.EntityName = relatedClassDef.GetTableName(propDef);
}
return orderCriteria;
}
catch (InvalidPropertyNameException)
{
throw new InvalidOrderCriteriaException("The orderByString '" + orderByString
+ "' is not valid for the classDef '" + classDef.ClassNameFull);
}
}
示例7: CreateQueryField
/// <summary>
/// Creates a <see cref="QueryField"/> given a classdef and a property name.
/// </summary>
/// <param name="classDef"></param>
/// <param name="propertyName"></param>
/// <returns></returns>
public static QueryField CreateQueryField(IClassDef classDef, string propertyName)
{
var propDef = classDef.GetPropDef(propertyName);
var propClassDef = (ClassDef)propDef.ClassDef;
var classNameExcludingTypeParameter = propClassDef.GetBaseClassOfSingleTableHierarchy().ClassNameExcludingTypeParameter;
var propSource = new Source(classNameExcludingTypeParameter, propClassDef.GetTableName(propDef));
return new QueryField(propDef.PropertyName, propDef.DatabaseFieldName, propSource);
}
示例8: GetPropertyType
#pragma warning restore 612,618
private static Type GetPropertyType(IClassDef classDef, string propertyName)
{
IPropDef def = classDef.GetPropDef(propertyName, false);
if (def == null) return classDef.GetPropertyType(propertyName);
var lookupList = def.LookupList;
Type propertyType = def.PropertyType;
if (lookupList != null && !(lookupList is NullLookupList))
{
propertyType = typeof(object);
}
return propertyType;
}