コード例 #1
0
ファイル: UniqueId.cs プロジェクト: arbinada-com/genie-lamp
        public void Update()
        {
            Macro.SetMacroColumns(Attributes.ToPersistentNamesString("_"));
            string constraintTemplate = Model.Lamp.Config.Layers.PersistenceConfig.NamingConvention.Params.ParamByName("Unique.ConstraintTemplate", Persistence.Name).Value;

            Persistence.UpdateNames(Const.EmptyName, Macro.Subst(constraintTemplate));
            index.InitBy(this);
            index.Generate = Model.Lamp.Config.Layers.PersistenceConfig.NamingConvention.Params.ParamByName(
                "Unique.CreateIndex", "true").AsBool;
        }
コード例 #2
0
ファイル: Generator.cs プロジェクト: arbinada-com/genie-lamp
        public void Update()
        {
            string persistentSchemaName = Model.DefaultPersistentSchema;

            if (entity != null)
            {
                persistentSchemaName = entity.Persistence.Schema;
            }
            // Naming
            string nameTemplate = Model.Lamp.Config.Layers.PersistenceConfig.NamingConvention.Params.ParamByName("Generator.Template", Persistence.Name).Value;

            Persistence.UpdateNames(persistentSchemaName, Macro.Subst(nameTemplate));
        }
コード例 #3
0
        public virtual void Update()
        {
            if (name == Const.EmptyName)
            {
                MakeName(RelationSide.Left);
            }
            if (name2 == Const.EmptyName)
            {
                MakeName(RelationSide.Right);
            }

            AttributesMatch.Update();

            Persistence.UpdateNames(Const.EmptyName, foreignKey.Name);
        }
コード例 #4
0
        public void Update()
        {
            // Naming
            string constraintTemplate = Model.Lamp.Config.Layers.PersistenceConfig.NamingConvention.Params.ParamByName("PrimaryKey.ConstraintTemplate", Persistence.Name).Value;

            Persistence.UpdateNames(Const.EmptyName, Macro.Subst(constraintTemplate));
            // Apply rule for non composite id only
            if (Attributes.Count == 1)
            {
                foreach (Attribute a in Attributes)
                {
                    string attributeTemplate = Model.Lamp.Config.Layers.PersistenceConfig.NamingConvention.Params.ParamByName(
                        "PrimaryKey.ColumnTemplate", a.Persistence.Name).Value;
                    a.Persistence.UpdateNames(Const.EmptyName, Macro.Subst(attributeTemplate));
                    a.Persistence.LockName();
                }
            }
            index.InitBy(this);
            index.Generate = Model.Lamp.Config.Layers.PersistenceConfig.NamingConvention.Params.ParamByName(
                "PrimaryKey.CreateIndex", "false").AsBool;
        }
コード例 #5
0
        public void Update()
        {
            persistence.UpdateNames(Schema, Name);
            EnumerationItem foundDefault = null;

            foreach (EnumerationItem item in Items)
            {
                item.Update();
                if (item.IsDefault)
                {
                    foundDefault = item;
                    break;
                }
            }
            if (foundDefault == null && Items.Count > 0)
            {
                foundDefault = Items.GetByIndex(0);
            }
            if (foundDefault != null)
            {
                this.defaultItem           = foundDefault;
                this.defaultItem.IsDefault = true;
            }
        }
コード例 #6
0
 public void Update()
 {
     persistence.UpdateNames(Const.EmptyName, Name);
 }
コード例 #7
0
        public void Update()
        {
            Macro.SetMacroTable(Name);
            string tableNameTemplate = Model.Lamp.Config.Layers.PersistenceConfig.NamingConvention.Params.ParamByName("Table.Template", Name).Value;
            string tableName         = Macro.Subst(Macro.Subst(tableNameTemplate));

            persistence.UpdateNames(Schema, tableName);

            Macro.SetMacroTable(persistence.Name);
            Attributes.Update();
            Constraints.Update();

            CreateGenerator();

            // Establish links with relations
            relations.Clear();
            parents.Clear();
            children.Clear();
            oneToOne.Clear();
            manyToMany.Clear();

            foreach (Relation relation in Model.Relations)
            {
                if (relation.ContainsEntity(this))
                {
                    relations.Add(relation);
                    switch (relation.Cardinality)
                    {
                    case Cardinality.R1_1:
                        oneToOne.Add(relation);
                        break;

                    case Cardinality.RM_M:
                        manyToMany.Add(relation);
                        break;

                    case Cardinality.R1_M:
                        if (relation.Entity.Equals(this))
                        {
                            children.Add(relation);
                        }
                        else
                        {
                            parents.Add(relation);
                        }
                        break;

                    case Cardinality.RM_1:
                        if (relation.Entity.Equals(this))
                        {
                            parents.Add(relation);
                        }
                        else
                        {
                            children.Add(relation);
                        }
                        break;
                    }
                }
            }
        }