コード例 #1
0
        public static void Call(Arebis.CodeGeneration.IGenerationHost host,
                                IZetboxContext ctx,
                                Templates.Serialization.SerializationMembersList serializationList,
                                ObjectReferenceProperty prop, bool callGetterSetterEvents,
                                bool updateInverseNavigator)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (prop == null)
            {
                throw new ArgumentNullException("prop");
            }

            string name                = prop.Name;
            string ownInterface        = prop.ObjectClass.GetDataTypeString();
            string referencedInterface = String.Format(
                "{0}.{1}",
                prop.GetReferencedObjectClass().Module.Namespace,
                prop.GetReferencedObjectClass().Name);

            var rel             = RelationExtensions.Lookup(ctx, prop);
            var endRole         = rel.GetEnd(prop).GetRole();
            var assocNameSuffix = String.Empty;

            Call(host, ctx, serializationList,
                 ownInterface, name, referencedInterface, rel, endRole, callGetterSetterEvents, updateInverseNavigator, assocNameSuffix);
        }
コード例 #2
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);
        }
コード例 #3
0
        public static void Call(Arebis.CodeGeneration.IGenerationHost host,
            IZetboxContext ctx,
            Templates.Serialization.SerializationMembersList serializationList,
            ObjectReferenceProperty prop, bool callGetterSetterEvents,
            bool updateInverseNavigator)
        {
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (prop == null) { throw new ArgumentNullException("prop"); }

            string name = prop.Name;
            string ownInterface = prop.ObjectClass.GetDataTypeString();
            string referencedInterface = String.Format(
                "{0}.{1}",
                prop.GetReferencedObjectClass().Module.Namespace,
                prop.GetReferencedObjectClass().Name);

            var rel = RelationExtensions.Lookup(ctx, prop);
            var endRole = rel.GetEnd(prop).GetRole();
            Call(host, ctx, serializationList,
                ownInterface, name, referencedInterface, rel, endRole, callGetterSetterEvents, updateInverseNavigator, String.Empty);
        }
コード例 #4
0
 public static void GetElementTypeString(ObjectReferenceProperty obj, MethodReturnEventArgs<string> e)
 {
     var def = obj.GetReferencedObjectClass();
     if (def == null)
     {
         e.Result = "<no class>";
     }
     else if (def.Module == null)
     {
         e.Result = "<no namespace>." + def.Name;
     }
     else
     {
         e.Result = def.Module.Namespace + "." + def.Name;
     }
     PropertyActions.DecorateElementType(obj, e, false);
 }
コード例 #5
0
        public static void GetElementTypeString(ObjectReferenceProperty obj, MethodReturnEventArgs <string> e)
        {
            var def = obj.GetReferencedObjectClass();

            if (def == null)
            {
                e.Result = "<no class>";
            }
            else if (def.Module == null)
            {
                e.Result = "<no namespace>." + def.Name;
            }
            else
            {
                e.Result = def.Module.Namespace + "." + def.Name;
            }
            PropertyActions.DecorateElementType(obj, e, false);
        }
コード例 #6
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);
 }
コード例 #7
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()));
        }