示例#1
0
 public override bool Equals(object obj)
 {
     if (obj == null)
     {
         return(false);
     }
     if (GetType() != obj.GetType())
     {
         return(false);
     }
     Net.Vpc.Upa.Expressions.IdExpression other = (Net.Vpc.Upa.Expressions.IdExpression)obj;
     if (this.id != other.id && (this.id == null || !this.id.Equals(other.id)))
     {
         return(false);
     }
     if ((this.entityName == null) ? (other.entityName != null) : !this.entityName.Equals(other.entityName))
     {
         return(false);
     }
     if ((this.alias == null) ? (other.alias != null) : !this.alias.Equals(other.alias))
     {
         return(false);
     }
     if (this.entity != other.entity && (this.entity == null || !this.entity.Equals(other.entity)))
     {
         return(false);
     }
     return(true);
 }
示例#2
0
 public virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression TranslateExpression(object x, Net.Vpc.Upa.Impl.Uql.ExpressionTranslationManager manager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Expressions.IdExpression o = (Net.Vpc.Upa.Expressions.IdExpression)x;
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression ret = null;
     Net.Vpc.Upa.Entity entity = null;
     if (o.GetEntity() != null)
     {
         entity = o.GetEntity();
     }
     Net.Vpc.Upa.PersistenceUnit persistenceUnit = manager.GetPersistenceUnit();
     if (entity == null && o.GetEntityName() != null)
     {
         entity = persistenceUnit.GetEntity(o.GetEntityName());
     }
     if (entity == null && o.GetAlias() != null)
     {
         //check if alias
         System.Collections.Generic.IList <Net.Vpc.Upa.Impl.Uql.ExpressionDeclaration> dvalues = declarations.GetDeclarations(null);
         if (dvalues != null)
         {
             foreach (Net.Vpc.Upa.Impl.Uql.ExpressionDeclaration @ref in dvalues)
             {
                 switch (@ref.GetReferrerType())
                 {
                 case Net.Vpc.Upa.Impl.Uql.DecObjectType.ENTITY:
                 {
                     entity = persistenceUnit.GetEntity((string)@ref.GetReferrerName());
                     break;
                 }
                 }
             }
         }
     }
     if (entity == null && o.GetAlias() != null)
     {
         //check if entity
         if (persistenceUnit.ContainsEntity(o.GetAlias()))
         {
             entity = persistenceUnit.GetEntity(o.GetAlias());
         }
     }
     if (entity == null)
     {
         throw new System.ArgumentException("Key enumeration must by associated to and entity");
     }
     Net.Vpc.Upa.Key    key     = entity.GetBuilder().IdToKey(o.GetId());
     object[]           values  = key == null ? null : key.GetValue();
     Net.Vpc.Upa.Entity entity1 = o.GetEntity();
     System.Collections.Generic.IList <Net.Vpc.Upa.PrimitiveField> f = entity1.ToPrimitiveFields <Net.Vpc.Upa.Field>(entity1.GetPrimaryFields());
     for (int i = 0; i < (f).Count; i++)
     {
         Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar ppp = o.GetAlias() == null ? null : new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(o.GetAlias());
         if (ppp == null)
         {
             ppp = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(f[i].GetName());
         }
         else
         {
             ppp.SetChild(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(f[i].GetName()));
         }
         Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEquals e = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEquals(ppp, new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(values == null ? null : values[i], Net.Vpc.Upa.Impl.Util.UPAUtils.GetTypeTransformOrIdentity(f[i])));
         ret = (ret == null) ? ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression)(e)) : new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledAnd(ret, e);
     }
     if (ret == null)
     {
         ret = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEquals(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(1), new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(1));
     }
     return(ret);
 }
示例#3
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.IdExpression o = new Net.Vpc.Upa.Expressions.IdExpression(entity, id, alias);
     return(o);
 }