Exemplo n.º 1
0
 private static void db2dttb(Context c, DProperty p, DObject owner, object v)
 {
     if (v == null || v is DataTable)
     {
         owner.set(p.Index, v);
     }
 }
Exemplo n.º 2
0
 public Converter(Convert ToDbValue, String dbType, int len = -1)
 {
     DBType         = dbType;
     this.ToDbValue = ToDbValue;
     IsComplex      = GetType() != typeof(BasicConverter);
     Length         = len == -1 ? DProperty.getSizeOf(dbType) : len;
 }
Exemplo n.º 3
0
            private int Add(Type propType, string propName, PropertyAttribute attribute, OnChanged OnChanged, Constraint OnUpload, string dbtype)
            {
                if (isFrozen)
                {
                    throw new Exception("");
                }
                var ps = getPropertiesOf(Type);
                var p  = new DProperty(Type, propType, propName, attribute, BaseMap.Count + ps.Count, OnChanged, OnUpload, dbtype);

                ps.Add(p);
                return(p.Index);
            }
Exemplo n.º 4
0
 public static void db2dtrw(Context c, DProperty p, DObject o, object v)
 {
     if (v == null)
     {
         o.set(p.Index, null);
     }
     else if (v is JNumber)
     {
         p.OnUpload(c.Database, new Path {
             Id = (long)((JNumber)v).Value, Owner = o, Property = p
         });
     }
     else if (v is DataRow)
     {
         o.set(p.Index, v);
     }
     else
     {
         if (v is JSON x)
         {
             if (c.Serializers.TryGetValue(x.Type ?? p.Type.FullName, out Typeserializer ts))
             {
                 var vl = ts.Swap(c, x, false);
                 if (x.Ref != null)
                 {
                     x.Ref.Value = vl;
                 }
                 o.set(p.Index, vl);
             }
             else
             {
                 throw null;
             }
         }
         else
         {
             Typeserializer ts;
             if (c.Serializers.TryGetValue(p.Type.FullName, out ts))
             {
                 var vl = ts.Swap(c, (JValue)v, false);
                 o.set(p.Index, vl);
             }
             throw null;
         }
     }
 }
Exemplo n.º 5
0
 protected virtual void OnPropertyChanged(DProperty dp)
 {
 }