示例#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);
     }
 }
示例#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);
        }
示例#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);
     }
 }
示例#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());
        }
示例#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);
     }
 }
示例#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);
        }
示例#9
0
        /// <summary>
        /// Creates a new CodeTemplate instance.
        /// </summary>
        public CodeTemplate(IGenerationHost _host)
        {
            // Store host
            this._host = _host;

            // Initialize:
            this.Initialize();
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
 }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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());
        }
示例#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);
 }
示例#22
0
 public ResourceTemplate(IGenerationHost host)
     : base(host)
 {
 }
示例#23
0
 public ReportTemplate(IGenerationHost host)
     : base(host)
 {
 }
示例#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);
        }
示例#26
0
 public ReportTemplate(IGenerationHost host)
     : base(host)
 {
 }
示例#27
0
 public ResourceTemplate(IGenerationHost host)
     : base(host)
 {
 }
示例#28
0
 public TemplateInfo(string filename, IGenerationHost host)
 {
     this.templatefileinfo = new FileInfo(filename);
     this.host             = host;
 }