示例#1
0
        public static void GetPropertyType(ObjectReferenceProperty obj, MethodReturnEventArgs <Type> e)
        {
            var def = obj.GetReferencedObjectClass();

            e.Result = Type.GetType(def.Module.Namespace + "." + def.Name + ", " + Zetbox.API.Helper.InterfaceAssembly, true);
            PropertyActions.DecorateParameterType(obj, e, false, obj.GetIsList(), obj.RelationEnd.Parent.GetOtherEnd(obj.RelationEnd).HasPersistentOrder);
        }
 public static void GetPropertyTypeString(ObjectReferenceProperty obj, MethodReturnEventArgs<string> e)
 {
     GetElementTypeString(obj, e);
     if (obj.RelationEnd != null)
     {
         PropertyActions.DecorateParameterType(obj, e, false, obj.GetIsList(), obj.RelationEnd.Parent.GetOtherEnd(obj.RelationEnd).HasPersistentOrder);
     }
 }
 public static void GetPropertyType(ObjectReferenceProperty obj, MethodReturnEventArgs<Type> e)
 {
     var def = obj.GetReferencedObjectClass();
     e.Result = Type.GetType(def.Module.Namespace + "." + def.Name + ", " + Zetbox.API.Helper.InterfaceAssembly, true);
     PropertyActions.DecorateParameterType(obj, e, false, obj.GetIsList(), obj.RelationEnd.Parent.GetOtherEnd(obj.RelationEnd).HasPersistentOrder);
 }
示例#4
0
        public static IValueModel GetDetachedValueModel(this Property prop, bool allowNullInput)
        {
            if (prop == null)
            {
                throw new ArgumentNullException("prop");
            }

            var lb = prop.GetLabel();

            if (prop is IntProperty)
            {
                return(new NullableStructValueModel <int>(lb, prop.Description, allowNullInput, false, prop.RequestedKind));
            }
            else if (prop is BoolProperty)
            {
                return(new BoolValueModel(lb, prop.Description, allowNullInput, false, prop.RequestedKind));
            }
            else if (prop is DoubleProperty)
            {
                return(new NullableStructValueModel <double>(lb, prop.Description, allowNullInput, false, prop.RequestedKind));
            }
            else if (prop is DecimalProperty)
            {
                return(new DecimalValueModel(lb, prop.Description, allowNullInput, false, prop.RequestedKind));
            }
            else if (prop is GuidProperty)
            {
                return(new NullableStructValueModel <Guid>(lb, prop.Description, allowNullInput, false, prop.RequestedKind));
            }
            else if (prop is DateTimeProperty)
            {
                var dtp = (DateTimeProperty)prop;
                return(new DateTimeValueModel(lb, prop.Description, allowNullInput, false, dtp.DateTimeStyle ?? DateTimeStyles.DateTime, prop.RequestedKind));
            }
            else if (prop is EnumerationProperty)
            {
                return(new EnumerationValueModel(lb, prop.Description, allowNullInput, false, prop.RequestedKind, ((EnumerationProperty)prop).Enumeration));
            }
            else if (prop is StringProperty)
            {
                return(new ClassValueModel <string>(lb, prop.Description, allowNullInput, false, prop.RequestedKind));
            }
            else if (prop is ObjectReferenceProperty)
            {
                ObjectReferenceProperty objRefProp = (ObjectReferenceProperty)prop;
                if (objRefProp.GetIsList())
                {
                    //var sorted = objRefProp.RelationEnd.Parent.GetOtherEnd(objRefProp.RelationEnd).HasPersistentOrder;
                    //if (sorted)
                    //{
                    //    return new ObjectListValueModel(obj, objRefProp);
                    //}
                    //else
                    //{
                    //    return new ObjectCollectionValueModel(obj, objRefProp);
                    //}
                }
                else
                {
                    return(new ObjectReferenceValueModel(lb, prop.Description, allowNullInput, false, prop.RequestedKind, objRefProp.GetReferencedObjectClass()));
                }
            }
            else if (prop is CompoundObjectProperty)
            {
                return(new CompoundObjectValueModel(lb, prop.Description, allowNullInput, false, prop.RequestedKind, ((CompoundObjectProperty)prop).CompoundObjectDefinition));
            }

            throw new NotImplementedException(string.Format("GetValueModel is not implemented for {0} properties yet", prop.GetPropertyTypeString()));
        }
示例#5
0
 public static void GetPropertyTypeString(ObjectReferenceProperty obj, MethodReturnEventArgs <string> e)
 {
     GetElementTypeString(obj, e);
     PropertyActions.DecorateParameterType(obj, e, false, obj.GetIsList(), obj.RelationEnd.Parent.GetOtherEnd(obj.RelationEnd).HasPersistentOrder);
 }