public static object GetObject(this Session session, PersistentCriteriaEvaluationBehavior behavior, object o) { if (o == null) { return(null); } XPMemberInfo property = ((PersistentBase)o).ClassInfo.KeyProperty; return(session.FindObject(behavior, o.GetType(), new BinaryOperator(property.Name, property.GetValue(o)))); }
public XpoObservableCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, CriteriaOperator condition) : base(criteriaEvaluationBehavior, session, condition) { }
public static IEnumerable <TClassType> QueryObjects <TClassType>(this IObjectSpace objectSpace, Expression <Func <TClassType, bool> > expression, PersistentCriteriaEvaluationBehavior behavior = PersistentCriteriaEvaluationBehavior.InTransaction) { var objectType = objectSpace.TypesInfo.FindBussinessObjectType <TClassType>(); var criteriaOperator = objectSpace.GetCriteriaOperator(expression); return(objectSpace.GetObjects(objectType, criteriaOperator, behavior == PersistentCriteriaEvaluationBehavior.InTransaction).Cast <TClassType>()); }
public static IEnumerable <TClassType> QueryObjects <TClassType>(this IObjectSpace objectSpace, PersistentCriteriaEvaluationBehavior behavior) { return(objectSpace.QueryObjects <TClassType>(null, behavior)); }
public static T FindObject <T>(this IObjectSpace objectSpace, Expression <Func <T, bool> > expression, PersistentCriteriaEvaluationBehavior persistentCriteriaEvaluationBehavior = PersistentCriteriaEvaluationBehavior.BeforeTransaction) { CriteriaOperator criteriaOperator; Type objectType = typeof(T); if (objectType.IsInterface) { objectType = XafTypesInfo.Instance.FindBussinessObjectType <T>(); criteriaOperator = GetCriteriaOperator(objectType, expression, (XPObjectSpace)objectSpace); } else { criteriaOperator = new XPQuery <T>(((XPObjectSpace)objectSpace).Session).TransformExpression(expression); } bool inTransaction = persistentCriteriaEvaluationBehavior == PersistentCriteriaEvaluationBehavior.InTransaction; return((T)objectSpace.FindObject(objectType, criteriaOperator, inTransaction)); }
public XpandXPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, Expression <Func <T, bool> > expression) : base(criteriaEvaluationBehavior, session, new XPQuery <T>(session).TransformExpression(expression)) { }
public XpandXPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, Expression <Func <T, bool> > condition, bool selectDeleted) : base(criteriaEvaluationBehavior, session, new XPQuery <T>(session).TransformExpression(condition), selectDeleted) { }
public XpandXPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, CriteriaOperator condition, bool selectDeleted) : base(criteriaEvaluationBehavior, session, condition, selectDeleted) { }
public static TClassType FindObject <TClassType>(this Session session, PersistentCriteriaEvaluationBehavior persistentCriteriaEvaluationBehavior, Expression <Func <TClassType, bool> > expression) { return((TClassType) session.FindObject(persistentCriteriaEvaluationBehavior, typeof(TClassType), new XPQuery <TClassType>(session).TransformExpression(expression))); }
public static T FindObject <T>(this XPObjectSpace objectSpace, Expression <Func <T, bool> > expression, PersistentCriteriaEvaluationBehavior persistentCriteriaEvaluationBehavior) { var objectType = XafTypesInfo.Instance.FindBussinessObjectType <T>(); CriteriaOperator criteriaOperator = GetCriteriaOperator(objectType, expression, objectSpace); bool inTransaction = persistentCriteriaEvaluationBehavior == PersistentCriteriaEvaluationBehavior.InTransaction; return((T)objectSpace.FindObject(objectType, criteriaOperator, inTransaction)); }