Exemplo n.º 1
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);
        }
 public static void Call(IGenerationHost _host, IZetboxContext ctx, IEnumerable<CompoundObjectProperty> properties, bool asCollectionEntry, string implementationSuffix, string implementationPropertySuffix, string lazyCtxProperty)
 {
     foreach (var p in properties.Where(p => asCollectionEntry || !p.IsList).OrderBy(p => p.Name))
     {
         Call(_host, ctx, p, asCollectionEntry, implementationSuffix, implementationPropertySuffix, lazyCtxProperty);
     }
 }
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,
                                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);
        }
 public static void Call(IGenerationHost _host, IZetboxContext ctx, IEnumerable<CompoundObjectProperty> properties, string implementationSuffix, string implementationPropertySuffix)
 {
     foreach (var p in properties.Where(p => !p.IsList).OrderBy(p => p.Name))
     {
         Call(_host, ctx, p, implementationSuffix, implementationPropertySuffix);
     }
 }
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");
            }
            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.º 7
0
 public static void Call(IGenerationHost _host, IZetboxContext ctx, IEnumerable<CompoundObjectProperty> properties, string implementationSuffix, string implementationPropertySuffix)
 {
     foreach (var p in properties.Where(p => !p.IsList).OrderBy(p => p.Name))
     {
         Call(_host, ctx, p, implementationSuffix, implementationPropertySuffix);
     }
 }
Exemplo n.º 8
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, DataType dataType, string implName)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (dataType == null) { throw new ArgumentNullException("dataType"); }

            var clsName = dataType.Name;
            Call(host, ctx, "IPersistenceObject", dataType, clsName, implName);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Creates a new CodeTemplate instance.
        /// </summary>
        public CodeTemplate(IGenerationHost _host)
        {
            // Store host
            this._host = _host;

            // Initialize:
            this.Initialize();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Creates a new CodeTemplate instance.
        /// </summary>
        public CodeTemplate(IGenerationHost _host)
        { 
            // Store host
            this._host = _host;

            // Initialize:
            this.Initialize();
        }
        public static void Call(IGenerationHost _host, IZetboxContext ctx, CompoundObjectProperty property, string implementationSuffix, string implementationPropertySuffix)
        {
            string propertyName = property.Name;
            string backingStoreName = propertyName + implementationPropertySuffix;
            string typeName = property.GetElementTypeString();
            string implementationTypeName = typeName + implementationSuffix;

            Call(_host, ctx, implementationTypeName, propertyName, backingStoreName);
        }
Exemplo n.º 12
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.º 13
0
        public static void Call(IGenerationHost _host, IZetboxContext ctx, CompoundObjectProperty property, string implementationSuffix, string implementationPropertySuffix)
        {
            string propertyName = property.Name;
            string backingStoreName = propertyName + implementationPropertySuffix;
            string typeName = property.GetElementTypeString();
            string implementationTypeName = typeName + implementationSuffix;

            Call(_host, ctx, implementationTypeName, propertyName, backingStoreName);
        }
Exemplo n.º 14
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, string otherInterface, DataType dataType, string implName)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (dataType == null) { throw new ArgumentNullException("dataType"); }

            var clsName = dataType.Name;

            Call(host, ctx, otherInterface, dataType, clsName, implName);
        }
        public static void Call(IGenerationHost _host, IZetboxContext ctx, CompoundObjectProperty property, bool asCollectionEntry, string implementationSuffix, string implementationPropertySuffix, string lazyCtxProperty)
        {
            string propertyName = asCollectionEntry ? "Value" : property.Name;
            string backingStoreName = propertyName + implementationPropertySuffix;
            string typeName = property.GetElementTypeString();
            string implementationTypeName = typeName + implementationSuffix;
            string lazyCtxParam = string.IsNullOrEmpty(lazyCtxProperty) ? "null" : lazyCtxProperty;

            Call(_host, ctx, implementationTypeName, propertyName, backingStoreName, lazyCtxParam);
        }
Exemplo n.º 16
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.º 17
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, DataType dataType, string implName)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (dataType == null)
            {
                throw new ArgumentNullException("dataType");
            }

            var clsName = dataType.Name;

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

            var clsName = dataType.Name;

            Call(host, ctx, otherInterface, dataType, clsName, implName);
        }
Exemplo n.º 19
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.º 20
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.º 21
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.º 22
0
 public ResourceTemplate(IGenerationHost host)
     : base(host)
 {
 }
Exemplo n.º 23
0
 public ReportTemplate(IGenerationHost host)
     : base(host)
 {
 }
Exemplo n.º 24
0
 public TemplateInfo(string filename, IGenerationHost host)
 {
     this.templatefileinfo = new FileInfo(filename);
     this.host = host;
 }
        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.º 26
0
 public ReportTemplate(IGenerationHost host)
     : base(host)
 {
 }
Exemplo n.º 27
0
 public ResourceTemplate(IGenerationHost host)
     : base(host)
 {
 }
Exemplo n.º 28
0
 public TemplateInfo(string filename, IGenerationHost host)
 {
     this.templatefileinfo = new FileInfo(filename);
     this.host             = host;
 }