Exemplo n.º 1
0
        public static void Call(IGenerationHost host, IZetboxContext ctx,
                                DataType dataType)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (dataType == null)
            {
                throw new ArgumentNullException("dataType");
            }

            var props = dataType
                        .Properties
                        .OfType <ObjectReferenceProperty>()
                        .OrderBy(p => p.Name)
                        .Where(p =>
            {
                Relation rel = RelationExtensions.Lookup(ctx, p);
                //RelationEnd relEnd = rel.GetEnd(p);

                return((rel.Storage == StorageType.MergeIntoA && rel.A.Navigator == p) ||
                       (rel.Storage == StorageType.MergeIntoB && rel.B.Navigator == p));
            })
                        .Select(p => new UpdateParentTemplateParams()
            {
                PropertyName = p.Name,
                IfType       = string.Format("{0}.{1}", p.GetReferencedObjectClass().Module.Namespace, p.GetReferencedObjectClass().Name)
            })
                        .ToList();

            host.CallTemplate("ObjectClasses.UpdateParentTemplate",
                              props);
        }
Exemplo n.º 2
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (cls == null)
            {
                throw new ArgumentNullException("cls");
            }

            string assocName                = Construct.SecurityRulesFKName(cls);
            string targetRoleName           = Construct.SecurityRulesClassName(cls);
            string referencedImplementation = Construct.SecurityRulesClassName(cls) + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix;
            string efNameRightsPropertyName = "SecurityRightsCollection" + Zetbox.API.Helper.ImplementationSuffix;

            host.CallTemplate("Properties.SecurityRulesProperties", ctx, cls,
                              assocName,
                              targetRoleName,
                              referencedImplementation,
                              efNameRightsPropertyName);
        }
Exemplo n.º 3
0
        public static void Call(IGenerationHost host, IZetboxContext ctx,
            DataType dataType)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (dataType == null) { throw new ArgumentNullException("dataType"); }

            var props = dataType
                .Properties
                .OfType<ObjectReferenceProperty>()
                .OrderBy(p => p.Name)
                .Where(p =>
                {
                    Relation rel = RelationExtensions.Lookup(ctx, p);
                    //RelationEnd relEnd = rel.GetEnd(p);

                    return (rel.Storage == StorageType.MergeIntoA && rel.A.Navigator == p)
                        || (rel.Storage == StorageType.MergeIntoB && rel.B.Navigator == p);
                })
                .Select(p => new UpdateParentTemplateParams()
                {
                    PropertyName = p.Name,
                    IfType = string.Format("{0}.{1}", p.GetReferencedObjectClass().Module.Namespace, p.GetReferencedObjectClass().Name)
                })
                .ToList();

            host.CallTemplate("ObjectClasses.UpdateParentTemplate",
                props);
        }
Exemplo n.º 4
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (cls == null)
            {
                throw new ArgumentNullException("cls");
            }
            if (cls.BaseObjectClass == null)
            {
                var msg = String.Format("Only subclasses can be joined subclasses, but {0} doesn't have a base class",
                                        cls.Name);
                throw new ArgumentOutOfRangeException("cls", msg);
            }

            host.CallTemplate("Mappings.JoinedSubclassHbm",
                              new object[] { ctx }
                              .Concat(ObjectClassHbm.MakeArgs(ctx, cls, host.Settings))
                              .ToArray());
        }
Exemplo n.º 5
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, Property prop, string propertyName, string parentName)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            host.CallTemplate("EfModel.ModelMslEntityTypeMappingComplexProperty", ctx, prop, propertyName, parentName);
        }
Exemplo n.º 6
0
 public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
 {
     if (host == null) { throw new ArgumentNullException("host"); }
     if (ctx == null) { throw new ArgumentNullException("ctx"); }
     if (cls == null) { throw new ArgumentNullException("cls"); }
     host.CallTemplate("ObjectClasses.SecurityRulesClass", ctx, cls,
         Construct.SecurityRulesFKName(cls),
         Construct.SecurityRulesClassName(cls),
         Construct.SecurityRulesClassName(cls) + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix);
 }
Exemplo n.º 7
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (cls == null) { throw new ArgumentNullException("cls"); }
            if (cls.BaseObjectClass == null)
            {
                var msg = String.Format("Only subclasses can be joined subclasses, but {0} doesn't have a base class",
                        cls.Name);
                throw new ArgumentOutOfRangeException("cls", msg);
            }

            host.CallTemplate("Mappings.SubclassHbm",
                new object[] { ctx }
                    .Concat(ObjectClassHbm.MakeArgs(ctx, cls, host.Settings))
                    .ToArray());
        }
Exemplo n.º 8
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (cls == null) { throw new ArgumentNullException("cls"); }

            string assocName = Construct.SecurityRulesFKName(cls);
            string targetRoleName = Construct.SecurityRulesClassName(cls);
            string referencedImplementation = Construct.SecurityRulesClassName(cls) + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix;
            string efNameRightsPropertyName = "SecurityRightsCollection" + Zetbox.API.Helper.ImplementationSuffix;

            host.CallTemplate("Properties.SecurityRulesProperties", ctx, cls,
                assocName,
                targetRoleName,
                referencedImplementation,
                efNameRightsPropertyName);
        }
Exemplo n.º 9
0
 public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if (ctx == null)
     {
         throw new ArgumentNullException("ctx");
     }
     if (cls == null)
     {
         throw new ArgumentNullException("cls");
     }
     host.CallTemplate("ObjectClasses.SecurityRulesClass", ctx, cls,
                       Construct.SecurityRulesFKName(cls),
                       Construct.SecurityRulesClassName(cls),
                       Construct.SecurityRulesClassName(cls) + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix);
 }
        public static void Call(IGenerationHost host, IZetboxContext ctx, Property prop, string propertyName, string parentName)
        {
            if (host == null) { throw new ArgumentNullException("host"); }

            host.CallTemplate("EfModel.ModelMslEntityTypeMappingComplexProperty", ctx, prop, propertyName, parentName);
        }