Esempio n. 1
0
        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)
 {
 }
Esempio n. 3
0
        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>());
        }
Esempio n. 4
0
 public static IEnumerable <TClassType> QueryObjects <TClassType>(this IObjectSpace objectSpace, PersistentCriteriaEvaluationBehavior behavior)
 {
     return(objectSpace.QueryObjects <TClassType>(null, behavior));
 }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
 public XpandXPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, Expression <Func <T, bool> > expression)
     : base(criteriaEvaluationBehavior, session, new XPQuery <T>(session).TransformExpression(expression))
 {
 }
Esempio n. 7
0
 public XpandXPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, Expression <Func <T, bool> > condition, bool selectDeleted)
     : base(criteriaEvaluationBehavior, session, new XPQuery <T>(session).TransformExpression(condition), selectDeleted)
 {
 }
Esempio n. 8
0
 public XpandXPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, CriteriaOperator condition, bool selectDeleted) : base(criteriaEvaluationBehavior, session, condition, selectDeleted)
 {
 }
Esempio n. 9
0
 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)));
 }
Esempio n. 10
0
        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));
        }