Пример #1
0
 public virtual Net.Vpc.Upa.Types.DataTypeTransform CreateTypeTransform(Net.Vpc.Upa.PersistenceUnit pu, Net.Vpc.Upa.Types.DataType source, Net.Vpc.Upa.Types.DataTypeTransformConfig[] configs) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Types.DataTypeTransform t = null;
     Net.Vpc.Upa.Types.DataType          s = source;
     if (configs != null)
     {
         foreach (Net.Vpc.Upa.Types.DataTypeTransformConfig c in configs)
         {
             if (c != null)
             {
                 Net.Vpc.Upa.Types.DataTypeTransform tt = CreateTypeTransform(pu, s, c);
                 if (t == null)
                 {
                     t = tt;
                 }
                 else
                 {
                     t = t.Chain(tt);
                 }
                 s = t.GetTargetType();
             }
         }
     }
     return(t);
 }
Пример #2
0
 public virtual void Cast(Net.Vpc.Upa.Types.DataType type)
 {
     if (!IsAssignableFrom(type))
     {
         throw new System.InvalidCastException("Expected an expression of type " + this + " but got " + type);
     }
 }
Пример #3
0
 public Literal(object @value, Net.Vpc.Upa.Types.DataType type)
 {
     //        if (
     //                value != null
     //                && !(value instanceof String)
     //                && !(value instanceof Number)
     //                && !(value instanceof Date)
     //                && !(value instanceof Boolean)
     //        ) {
     //            throw new IllegalArgumentException("bad sql value : " + value.getClass().getName() + " ==> " + value);
     //        } else {
     this.@value = @value;
     if (type == null)
     {
         if (@value == null)
         {
             type = Net.Vpc.Upa.Types.TypesFactory.OBJECT;
         }
         else
         {
             type = Net.Vpc.Upa.Types.TypesFactory.ForPlatformType(@value.GetType());
         }
     }
     this.type = type;
 }
Пример #4
0
 public DataTypeTransformList(Net.Vpc.Upa.Types.DataTypeTransform[] others)
 {
     System.Collections.Generic.List <Net.Vpc.Upa.Types.DataTypeTransform> all = new System.Collections.Generic.List <Net.Vpc.Upa.Types.DataTypeTransform>();
     Net.Vpc.Upa.Types.DataType src = null;
     foreach (Net.Vpc.Upa.Types.DataTypeTransform i in others)
     {
         if (i != null)
         {
             if (src != null)
             {
                 if (!i.GetSourceType().IsAssignableFrom(src))
                 {
                     throw new System.ArgumentException("Invalid " + src + " expected " + i.GetSourceType());
                 }
             }
             src = i.GetTargetType();
             if (i is Net.Vpc.Upa.Impl.Transform.DataTypeTransformList)
             {
                 Net.Vpc.Upa.Impl.FwkConvertUtils.CollectionAddRange(all, new System.Collections.Generic.List <Net.Vpc.Upa.Types.DataTypeTransform>(((Net.Vpc.Upa.Impl.Transform.DataTypeTransformList)i).items));
             }
             else
             {
                 all.Add(i);
             }
         }
     }
     this.items = all.ToArray();
 }
Пример #5
0
 public StringEncoderDataTypeTransform(Net.Vpc.Upa.Types.StringEncoder stringEncoder, Net.Vpc.Upa.Types.DataType sourceType, int?max, Net.Vpc.Upa.Types.ByteArrayEncoder serializer)
 {
     this.serializer    = serializer;
     this.stringEncoder = stringEncoder;
     this.sourceType    = sourceType;
     this.targetType    = new Net.Vpc.Upa.Types.StringType(null, 0, max == null ? ((Net.Vpc.Upa.Types.DataType)(255)) : max, sourceType.IsNullable());
 }
Пример #6
0
        public override R RecordToObject <R>(Net.Vpc.Upa.Record record)
        {
            if (record is Net.Vpc.Upa.Impl.BeanAdapterRecord)
            {
                Net.Vpc.Upa.Impl.BeanAdapterRecord g = (Net.Vpc.Upa.Impl.BeanAdapterRecord)record;
                return((R)g.UserObject());
            }
            object obj = CreateObject <R>();

            Net.Vpc.Upa.Record ur = ObjectToRecord(obj, true);
            foreach (string k in record.KeySet())
            {
                object o = record.GetObject <T>(k);
                if (o is Net.Vpc.Upa.Record)
                {
                    Net.Vpc.Upa.Field          f  = entity.FindField(k);
                    Net.Vpc.Upa.Types.DataType dt = f.GetDataType();
                    if (dt is Net.Vpc.Upa.Types.ManyToOneType)
                    {
                        Net.Vpc.Upa.Entity oe = ((Net.Vpc.Upa.Types.ManyToOneType)dt).GetRelationship().GetTargetEntity();
                        o = oe.GetBuilder().RecordToObject <R>((Net.Vpc.Upa.Record)o);
                    }
                }
                ur.SetObject(k, o);
            }
            //        ur.setAll(unstructuredRecord);
            return((R)obj);
        }
Пример #7
0
 public static Net.Vpc.Upa.Impl.Util.ExprTypeInfo ResolveExprTypeInfo(Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression e, bool byBrother)
 {
     if (e is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarOrMethod)
     {
         e = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarOrMethod)e).GetFinest();
         object r = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarOrMethod)e).GetReferrer();
         if (r is Net.Vpc.Upa.Field)
         {
             Net.Vpc.Upa.Types.DataTypeTransform tr = GetTypeTransformOrIdentity(((Net.Vpc.Upa.Field)r));
             Net.Vpc.Upa.Impl.Util.ExprTypeInfo  i  = new Net.Vpc.Upa.Impl.Util.ExprTypeInfo();
             i.SetReferrer(r);
             i.SetTransform(tr);
             if (e is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)
             {
                 Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar cv = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)e;
                 i.SetOldReferrer(cv.GetOldReferrer());
             }
             return(i);
         }
     }
     if (e is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal)
     {
         Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarOrMethod v = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal)e).GetVar();
         return(ResolveExprTypeInfo(v));
     }
     Net.Vpc.Upa.Types.DataTypeTransform typeTransform = e.GetTypeTransform();
     if (e is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam || e is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral)
     {
         Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression p = e.GetParentExpression();
         if (p is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal)
         {
             return(ResolveExprTypeInfo(p));
         }
         else
         {
             object @object = (e is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam) ? ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)e).GetValue() : ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral)e).GetValue();
             Net.Vpc.Upa.Types.DataType          sourceType = typeTransform.GetSourceType();
             Net.Vpc.Upa.Types.DataTypeTransform bestType   = typeTransform;
             if ((p is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression) && (((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression)p).IsSameOperandsType()))
             {
                 Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression o = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledBinaryOperatorExpression)p).GetOther(e);
                 if (byBrother)
                 {
                     return(ResolveExprTypeInfo(o, false));
                 }
             }
             if (@object != null && (typeTransform.Equals(Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform.OBJECT) || !sourceType.IsInstance(@object)))
             {
                 bestType = Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform.ForNativeType(@object.GetType());
             }
             Net.Vpc.Upa.Impl.Util.ExprTypeInfo typeInfo1 = new Net.Vpc.Upa.Impl.Util.ExprTypeInfo();
             typeInfo1.SetTransform(bestType);
             return(typeInfo1);
         }
     }
     Net.Vpc.Upa.Impl.Util.ExprTypeInfo typeInfo2 = new Net.Vpc.Upa.Impl.Util.ExprTypeInfo();
     typeInfo2.SetTransform(typeTransform);
     return(typeInfo2);
 }
Пример #8
0
 public NullVal(Net.Vpc.Upa.Expressions.Expression[] expressions)
 {
     if (expressions.Length != 0 && expressions.Length != 1 && expressions.Length != 2)
     {
         CheckArgCount(GetName(), expressions, 1);
     }
     this.type = (Net.Vpc.Upa.Types.DataType)((Net.Vpc.Upa.Expressions.Cst)expressions[0]).GetValue();
 }
Пример #9
0
 public virtual void AddGeneratedValue(string name, Net.Vpc.Upa.Types.DataType type)
 {
     if (generatedValues.ContainsKey(name))
     {
         throw new System.ArgumentException("GeneratedValue already exists " + name);
     }
     generatedValues[name] = new Net.Vpc.Upa.Persistence.DefaultParameter(name, null, new Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform(type));
 }
Пример #10
0
 protected internal virtual void ValidateChildren(object key, Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Record r = GetEntity().CreateQueryBuilder().ByExpression(GetEntity().GetBuilder().IdToExpression(key, null)).SetFieldFilter(Net.Vpc.Upa.Filters.Fields.ByName(GetHierarchyPathField())).GetRecord();
     System.Collections.Generic.IList <Net.Vpc.Upa.Field> lfs = GetTreeRelationship().GetSourceRole().GetFields();
     Net.Vpc.Upa.Expressions.Concat concat = new Net.Vpc.Upa.Expressions.Concat();
     concat.Add(new Net.Vpc.Upa.Expressions.Literal(r.GetString(GetHierarchyPathField()), GetEntity().GetField(GetHierarchyPathField()).GetDataType()));
     System.Collections.Generic.IList <Net.Vpc.Upa.Field> primaryFields = GetEntity().GetPrimaryFields();
     foreach (Net.Vpc.Upa.Field f in primaryFields)
     {
         concat.Add(new Net.Vpc.Upa.Expressions.Literal(GetHierarchyPathSeparator()));
         Net.Vpc.Upa.Types.DataType         t    = f.GetDataType();
         Net.Vpc.Upa.Expressions.Var        var  = new Net.Vpc.Upa.Expressions.Var(f.GetName());
         Net.Vpc.Upa.Expressions.Expression svar = null;
         if (t is Net.Vpc.Upa.Types.StringType)
         {
             svar = var;
         }
         else if (t is Net.Vpc.Upa.Types.IntType)
         {
             svar = new Net.Vpc.Upa.Expressions.I2V(var);
         }
         else if (t is Net.Vpc.Upa.Types.LongType)
         {
             svar = new Net.Vpc.Upa.Expressions.I2V(var);
         }
         else if (t is Net.Vpc.Upa.Types.DoubleType)
         {
             svar = new Net.Vpc.Upa.Expressions.D2V(var);
         }
         else if (t is Net.Vpc.Upa.Types.FloatType)
         {
             svar = new Net.Vpc.Upa.Expressions.D2V(var);
         }
         else
         {
             throw new System.ArgumentException("Unsupported ");
         }
         concat.Add(svar);
     }
     Net.Vpc.Upa.Record s = GetEntity().GetBuilder().CreateRecord();
     s.SetObject(GetHierarchyPathField(), concat);
     Net.Vpc.Upa.Expressions.Expression p   = null;
     Net.Vpc.Upa.Relationship           rel = GetTreeRelationship();
     object[] kvalue = GetEntity().GetBuilder().IdToKey(key).GetValue();
     for (int i = 0; i < rel.Size(); i++)
     {
         Net.Vpc.Upa.Field field = lfs[i];
         Net.Vpc.Upa.Expressions.Expression e = (new Net.Vpc.Upa.Expressions.Equals(new Net.Vpc.Upa.Expressions.Var(field.GetName()), new Net.Vpc.Upa.Expressions.Literal(kvalue[i], field.GetDataType())));
         p = p == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(p, e);
     }
     GetEntity().UpdateCore(s, p, executionContext);
     System.Collections.Generic.IList <object> children = GetEntity().CreateQueryBuilder().ByExpression(p).GetIdList <K>();
     foreach (object aChildren in children)
     {
         ValidateChildren(aChildren, executionContext);
     }
 }
Пример #11
0
        public PasswordDataTypeTransform(Net.Vpc.Upa.PasswordStrategy passwordStrategy, object cipherValue, Net.Vpc.Upa.Types.DataType sourceType)
        {
            this.passwordStrategy = passwordStrategy;
            this.cipherValue      = cipherValue;
            this.sourceType       = sourceType;
            int max = passwordStrategy.GetMaxSize();

            this.targetType = new Net.Vpc.Upa.Types.StringType(null, 0, (max <= 0) ? 255 : max, sourceType.IsNullable());
        }
Пример #12
0
 private static Net.Vpc.Upa.Types.DataType[] ConstructorFieldTypes(Net.Vpc.Upa.Entity entity) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Field> primaryFields = entity.GetPrimaryFields();
     Net.Vpc.Upa.Types.DataType[] dt = new Net.Vpc.Upa.Types.DataType[(primaryFields).Count];
     for (int i = 0; i < dt.Length; i++)
     {
         dt[i] = primaryFields[i].GetDataType();
     }
     return(dt);
 }
Пример #13
0
 public static object ParseStringValue(string s, Net.Vpc.Upa.Types.DataType dataType, object defaultValue) /* throws System.Exception */
 {
     if (s == null || (s).Length == 0)
     {
         return(defaultValue);
     }
     System.Type c = dataType.GetPlatformType();
     if (typeof(string).Equals(c))
     {
         return(s);
     }
     else if (typeof(char?).Equals(c))
     {
         return(s[0]);
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt32(c))
     {
         return(System.Convert.ToInt32(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt64(c))
     {
         return(System.Convert.ToInt64(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt16(c))
     {
         return(System.Convert.ToInt16(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt8(c))
     {
         return(System.Convert.ToByte(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsFloat64(c))
     {
         return(System.Convert.ToDouble(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsFloat32(c))
     {
         return(System.Convert.ToSingle(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsBigInt(c))
     {
         return(Net.Vpc.Upa.Impl.FwkConvertUtils.CreateBigInteger(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsAnyDate(c))
     {
         Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> vv = new Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string>();
         vv.SetValue(s);
         return(ParseDate(c, vv, new Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string>(), false));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsBool(c))
     {
         return(System.Convert.ToBoolean(s));
     }
     return(null);
 }
Пример #14
0
 public override void SetArgument(int index, Net.Vpc.Upa.Expressions.Expression e)
 {
     if (index == 0)
     {
         this.@value = e;
     }
     else
     {
         this.targetType = (Net.Vpc.Upa.Types.DataType)((Net.Vpc.Upa.Expressions.Cst)e).GetValue();
     }
 }
Пример #15
0
 public virtual string FormatSqlValue(object @value, Net.Vpc.Upa.Types.DataType datatype)
 {
     if (@value == null)
     {
         return(nullMarshaller.ToSQLLiteral(null));
     }
     else
     {
         return(GetTypeMarshaller(@value.GetType()).ToSQLLiteral(@value));
     }
 }
Пример #16
0
 public override void SetArgument(int index, Net.Vpc.Upa.Expressions.Expression e)
 {
     if (index == 0)
     {
         this.type = (Net.Vpc.Upa.Types.DataType)((Net.Vpc.Upa.Expressions.Cst)e).GetValue();
     }
     else
     {
         throw new System.IndexOutOfRangeException();
     }
 }
Пример #17
0
 private void SetValue(object o)
 {
     this.@value = o;
     if (o == null)
     {
         type = Net.Vpc.Upa.Types.TypesFactory.OBJECT;
     }
     else
     {
         type = Net.Vpc.Upa.Types.TypesFactory.ForPlatformType(o.GetType());
     }
 }
Пример #18
0
 public static Net.Vpc.Upa.Types.DataType ForPlatformType(System.Type clazz)
 {
     Net.Vpc.Upa.Types.DataType o = Net.Vpc.Upa.FwkConvertUtils.GetMapValue <System.Type, Net.Vpc.Upa.Types.DataType>(defaultMapping, clazz);
     if (o != null)
     {
         return(o);
     }
     if ((clazz).IsEnum)
     {
         return(new Net.Vpc.Upa.Types.EnumType(clazz, true));
     }
     return(OBJECT);
 }
Пример #19
0
 public virtual Net.Vpc.Upa.FunctionDefinition AddFunction(string name, Net.Vpc.Upa.Types.DataType type, Net.Vpc.Upa.Function function)
 {
     if (name == null || function == null)
     {
         throw new System.NullReferenceException();
     }
     if (ContainsFunction(name))
     {
         throw new System.ArgumentException("Function already exists " + name);
     }
     Net.Vpc.Upa.FunctionDefinition q = new Net.Vpc.Upa.Impl.Uql.DefaultFunction(name, type, function);
     AddFunction(q);
     return(q);
 }
Пример #20
0
 public virtual void Parse(System.Collections.Generic.IList <System.Reflection.FieldInfo> fields, bool nullable)
 {
     fieldsList = fields;
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> manyToOneDecorations = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> hierarchyDecorations = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     foreach (System.Reflection.FieldInfo javaField in fields)
     {
         Net.Vpc.Upa.Config.Decoration gid  = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.ManyToOne));
         Net.Vpc.Upa.Config.Decoration gid2 = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.Hierarchy));
         if (gid != null)
         {
             //                ConfigInfo config = gid.getConfig();
             manyToOneDecorations.Add(gid);
         }
         if (gid2 != null)
         {
             //                ConfigInfo config = gid.getConfig();
             hierarchyDecorations.Add(gid2);
         }
     }
     if ((manyToOneDecorations).Count > 1)
     {
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(manyToOneDecorations, Net.Vpc.Upa.Impl.Config.Annotationparser.DecorationComparator.INSTANCE);
     }
     if ((hierarchyDecorations).Count > 1)
     {
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(hierarchyDecorations, Net.Vpc.Upa.Impl.Config.Annotationparser.DecorationComparator.INSTANCE);
     }
     foreach (Net.Vpc.Upa.Config.Decoration gid in manyToOneDecorations)
     {
         MergeManyToOne(gid);
     }
     foreach (Net.Vpc.Upa.Config.Decoration gid in hierarchyDecorations)
     {
         MergeHierarchy(gid);
     }
     if (GetTargetEntityType() == null || GetTargetEntityType().Equals(typeof(void)))
     {
         SetTargetEntityType(GetFieldType());
     }
     if (IsManyToOne())
     {
         System.Type nativeClass = GetFieldType();
         if (!Net.Vpc.Upa.Impl.Util.UPAUtils.IsSimpleFieldType(nativeClass))
         {
             Net.Vpc.Upa.Types.ManyToOneType manyToOneType = new Net.Vpc.Upa.Types.ManyToOneType(name, nativeClass, null, true, nullable);
             preferredDataType = (manyToOneType);
         }
     }
 }
Пример #21
0
        public virtual object GetMainValue(object instance)
        {
            object v = GetValue(instance);

            if (v != null)
            {
                Net.Vpc.Upa.Types.DataType d = GetDataType();
                if (d is Net.Vpc.Upa.Types.ManyToOneType)
                {
                    Net.Vpc.Upa.Types.ManyToOneType ed = (Net.Vpc.Upa.Types.ManyToOneType)d;
                    v = ed.GetRelationship().GetTargetEntity().GetBuilder().GetMainValue(v);
                }
            }
            return(v);
        }
 private System.Collections.Generic.ISet <string> FindEntityDependencies(Net.Vpc.Upa.Entity o1)
 {
     System.Collections.Generic.ISet <string> all = new System.Collections.Generic.HashSet <string>();
     foreach (Net.Vpc.Upa.Field field in o1.GetFields())
     {
         if (!field.GetModifiers().Contains(Net.Vpc.Upa.FieldModifier.TRANSIENT))
         {
             Net.Vpc.Upa.Types.DataType dt = field.GetDataType();
             if (dt is Net.Vpc.Upa.Types.ManyToOneType)
             {
                 all.Add(((Net.Vpc.Upa.Types.ManyToOneType)dt).GetRelationship().GetTargetEntity().GetName());
             }
         }
     }
     return(all);
 }
 private void BindRelation(Net.Vpc.Upa.Entity masterEntity)
 {
     Net.Vpc.Upa.Types.DataType dataType = field.GetDataType();
     if (dataType is Net.Vpc.Upa.Impl.SerializableOrManyToOneType)
     {
         field.SetDataType(new Net.Vpc.Upa.Types.ManyToOneType(dataType.GetName(), dataType.GetPlatformType(), masterEntity.GetName(), true, dataType.IsNullable()));
         field.SetTypeTransform(null);
         field.SetTypeTransform(new Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform(field.GetDataType()));
         Net.Vpc.Upa.DefaultRelationshipDescriptor relationDescriptor = new Net.Vpc.Upa.DefaultRelationshipDescriptor();
         relationDescriptor.SetBaseField(field.GetName());
         relationDescriptor.SetTargetEntityType(masterEntity.GetEntityType());
         relationDescriptor.SetTargetEntity(masterEntity.GetName());
         relationDescriptor.SetSourceEntityType(field.GetEntity().GetEntityType());
         relationDescriptor.SetSourceEntity(field.GetEntity().GetName());
         field.GetPersistenceUnit().AddRelationship(relationDescriptor);
     }
 }
 public virtual void OnModelChanged(Net.Vpc.Upa.Callbacks.PersistenceUnitEvent @event)
 {
     Net.Vpc.Upa.Types.DataType dataType = field.GetDataType();
     if (dataType is Net.Vpc.Upa.Impl.SerializableOrManyToOneType)
     {
         Net.Vpc.Upa.Impl.SerializableOrManyToOneType masterDatatype = (Net.Vpc.Upa.Impl.SerializableOrManyToOneType)dataType;
         System.Type tt = masterDatatype.GetEntityType();
         if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsSerializable(tt))
         {
             field.SetDataType(new Net.Vpc.Upa.Types.SerializableType(masterDatatype.GetName(), tt, masterDatatype.IsNullable()));
             field.SetTypeTransform(null);
         }
         else
         {
             throw new System.ArgumentException("Type " + tt + " is neither Entity nor Serializable for " + field);
         }
     }
 }
Пример #25
0
 public DefaultResultField(Net.Vpc.Upa.Expressions.Expression expression, string alias, Net.Vpc.Upa.Types.DataType dataType, Net.Vpc.Upa.Field field, Net.Vpc.Upa.Entity entity)
 {
     this.expression = expression;
     if (alias == null)
     {
         if (expression is Net.Vpc.Upa.Expressions.Var)
         {
             alias = ((Net.Vpc.Upa.Expressions.Var)expression).GetName();
         }
         else
         {
             alias = expression.ToString();
         }
     }
     this.alias    = alias;
     this.dataType = dataType;
     this.field    = field;
     this.entity   = entity;
 }
 public virtual void Process()
 {
     Net.Vpc.Upa.Types.DataType dataType = field.GetDataType();
     if (dataType is Net.Vpc.Upa.Impl.SerializableOrManyToOneType)
     {
         Net.Vpc.Upa.Impl.SerializableOrManyToOneType master = (Net.Vpc.Upa.Impl.SerializableOrManyToOneType)dataType;
         relationshipTargetEntityType = master.GetEntityType();
         if (persistenceUnit.ContainsEntity(relationshipTargetEntityType))
         {
             Net.Vpc.Upa.Entity tt = persistenceUnit.GetEntity(relationshipTargetEntityType);
             BindRelation(tt);
         }
         else
         {
             persistenceUnit.AddDefinitionListener(relationshipTargetEntityType, this, true);
             persistenceUnit.AddPersistenceUnitListener(this);
         }
     }
 }
Пример #27
0
 public static Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform ForDataType(Net.Vpc.Upa.Types.DataType sourceType)
 {
     return(new Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform(sourceType));
 }
Пример #28
0
 public virtual Net.Vpc.Upa.DefaultFieldDescriptor SetDataType(Net.Vpc.Upa.Types.DataType dataType)
 {
     this.dataType = dataType;
     return(this);
 }
Пример #29
0
 public IdentityDataTypeTransform(Net.Vpc.Upa.Types.DataType sourceType)
 {
     this.sourceType = sourceType;
 }
Пример #30
0
 public DefaultFunction(string name, Net.Vpc.Upa.Types.DataType type, Net.Vpc.Upa.Function handler)
 {
     this.name    = name;
     this.type    = type;
     this.handler = handler;
 }