public void SetUpdatable(bool forUpdate) { this.updatable = forUpdate; if (query != null) { query.SetUpdatable(forUpdate); } }
private Net.Vpc.Upa.Query Build() { // if (query == null) { string entityName = entity.GetName(); Net.Vpc.Upa.Expressions.Select s = (new Net.Vpc.Upa.Expressions.Select()).From(entityName, entityAlias); if (GetFieldFilter() != null) { foreach (Net.Vpc.Upa.Field field in entity.GetFields(GetFieldFilter())) { if (field != null) { s.Field(new Net.Vpc.Upa.Expressions.Var(field.GetName()), field.GetName()); } } } Net.Vpc.Upa.Expressions.Expression criteria = null; if (GetId() != null) { Net.Vpc.Upa.Expressions.Expression e = entity.GetBuilder().IdToExpression(GetId(), entityName); criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e); } if (GetKey() != null) { Net.Vpc.Upa.Expressions.Expression e = (entity.GetBuilder().IdToExpression(entity.GetBuilder().KeyToId(GetKey()), entityName)); criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e); } if (GetPrototype() != null) { Net.Vpc.Upa.Expressions.Expression e = entity.GetBuilder().ObjectToExpression(GetPrototype(), true, entityName); criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e); } if (GetRecordPrototype() != null) { Net.Vpc.Upa.Expressions.Expression e = (entity.GetBuilder().RecordToExpression(GetRecordPrototype(), entityName)); criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e); } if (GetExpression() != null) { Net.Vpc.Upa.Expressions.Expression e = GetExpression(); criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e); } s.SetWhere(criteria); s.OrderBy(GetOrder()); query = entity.CreateQuery(s); foreach (System.Collections.Generic.KeyValuePair <string, object> e in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, object> >(paramsByName)) { query.SetParameter((e).Key, (e).Value); } foreach (System.Collections.Generic.KeyValuePair <int?, object> e in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <int?, object> >(paramsByIndex)) { query.SetParameter(((e).Key).Value, (e).Value); } query.SetUpdatable(this.IsUpdatable()); if (hints != null) { foreach (System.Collections.Generic.KeyValuePair <string, object> h in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, object> >(hints)) { query.SetHint((h).Key, (h).Value); } } // } return(query); }