예제 #1
0
 public NotifyingDataProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Serialization.SerializationMembersList serializationList, Property prop)
     : this(_host, ctx, serializationList, 
             prop.GetElementTypeString(), 
             prop.Name, prop.Module.Namespace, "_" + prop.Name, 
             prop.IsCalculated(), prop.DisableExport == true, 
             prop.ObjectClass.Name, prop.IsNullable(),
             prop.DefaultValue != null && !prop.IsCalculated(), // No default value for calculated properties, default values are used then for database migration
             prop.ExportGuid)
 {
 }
예제 #2
0
 public NotifyingDataProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Serialization.SerializationMembersList serializationList, Property prop)
     : base(_host, ctx, serializationList, prop.GetElementTypeString(), prop.Name, prop.Module.Namespace, "_" + prop.Name, prop.IsCalculated(), prop.DisableExport == true)
 {
     _prop = prop;
 }
 private bool IsPropAvailable(Property prop)
 {
     if ((FollowRelationsOne || FollowRelationsMany) && prop is ObjectReferenceProperty)
     {
         var objRefProp = (ObjectReferenceProperty)prop;
         return
             (FollowRelationsOne && !objRefProp.GetIsList()) ||
             (FollowRelationsMany && objRefProp.GetIsList());
     }
     else if (prop.IsCalculated() && !ShowCalculated)
     {
         return false;
     }
     return true;
 }
예제 #4
0
 protected virtual void ApplyPropertyIsValidEvent(Property p)
 {
     if (!p.IsCalculated())
     {
         this.WriteLine();
         this.WriteObjects("        public static event PropertyIsValidHandler<", p.ObjectClass.GetDataTypeString(), "> On", p.Name, "_IsValid;");
         this.WriteLine();
     }
 }
예제 #5
0
 protected virtual void ApplyPropertyEvents(Property p, bool isReadOnly)
 {
     Properties.PropertyEvents.Call(Host, ctx, p, isReadOnly || p.IsCalculated());
 }
예제 #6
0
        public static void get_CodeTemplate(Property obj, PropertyGetterEventArgs<string> e)
        {
            StringBuilder sb = new StringBuilder();

            string type = obj.ObjectClass != null ? obj.ObjectClass.Name : "<<TYPE>>";
            string propType = obj.GetPropertyTypeString();

            sb.AppendFormat("[Invocation]\npublic static void {0}_{1}({2} obj, {3}<{4}> e)\n{{\n}}\n\n", "get", obj.Name, type, "PropertyGetterEventArgs", propType);
            if (!obj.IsCalculated())
            {
                sb.AppendFormat("[Invocation]\npublic static void {0}_{1}({2} obj, {3}<{4}> e)\n{{\n}}\n\n", "preSet", obj.Name, type, "PropertyPreSetterEventArgs", propType);
                sb.AppendFormat("[Invocation]\npublic static void {0}_{1}({2} obj, {3}<{4}> e)\n{{\n}}\n\n", "postSet", obj.Name, type, "PropertyPostSetterEventArgs", propType);
                sb.AppendFormat("[Invocation]\npublic static void {0}_{1}({2} obj, {3} e)\n{{\n\te.IsValid = obj.{1} == ...;\n\te.Error = e.IsValid ? string.Empty : \"<Error>\";\n}}\n\n", "isValid", obj.Name, type, "PropertyIsValidEventArgs");
            }

            e.Result = sb.ToString();
        }
예제 #7
0
 protected override void ApplyNotifyingValueProperty(
     Property prop,
     Templates.Serialization.SerializationMembersList serList)
 {
     Properties.ProxyProperty.Call(Host, ctx,
         serList, prop.Module.Namespace, prop.GetElementTypeString(), prop.Name, false, true,
         prop.DefaultValue != null, prop.ObjectClass.GetDataTypeString(),
         prop.GetClassName(),
         prop.IsNullable(),
         "_is" + prop.Name + "Set",
         prop.ExportGuid,
         prop.GetElementTypeString(),
         "Proxy." + prop.Name,
         prop.IsCalculated(),
         prop.DisableExport == true);
 }