Ejemplo n.º 1
0
        public void CreateExtraInfos(Column column, IPersistentMemberInfo persistentMemberInfo, ForeignKeyCalculator foreignKeyCalculator) {
            var persistentReferenceMemberInfo = (IPersistentReferenceMemberInfo)persistentMemberInfo;
            if (persistentMemberInfo.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPOneToOnePropertyMember) {
                CreateTemplateInfo(persistentReferenceMemberInfo, column, foreignKeyCalculator);
            } else if (!column.InPrimaryKey && persistentMemberInfo.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPReadWritePropertyMember)
                CreateCollection(persistentReferenceMemberInfo, persistentReferenceMemberInfo.Owner);

        }
Ejemplo n.º 2
0
 void CreateTemplateInfo(IPersistentReferenceMemberInfo persistentReferenceMemberInfo, Column column, ForeignKeyCalculator _foreignKeyCalculator) {
     var table = (Table)column.Parent;
     var database = table.Parent;
     var foreignKey = _foreignKeyCalculator.GetForeignKey(database, column.Name, table);
     var templateInfo = _objectSpace.CreateWCObject<ITemplateInfo>();
     templateInfo.Name = persistentReferenceMemberInfo.CodeTemplateInfo.CodeTemplate.TemplateType.ToString();
     templateInfo.TemplateCode =
         _foreignKeyCalculator.GetRefTableForeignKey(foreignKey, column.Name).Columns.OfType<ForeignKeyColumn>().
             Where(keyColumn => keyColumn.ReferencedColumn == column.Name).Single().Name;
     persistentReferenceMemberInfo.TemplateInfos.Add(templateInfo);
 }
Ejemplo n.º 3
0
        void CreateTemplateInfo(IPersistentReferenceMemberInfo persistentReferenceMemberInfo, Column column, ForeignKeyCalculator _foreignKeyCalculator)
        {
            var table        = (Table)column.Parent;
            var database     = table.Parent;
            var foreignKey   = _foreignKeyCalculator.GetForeignKey(database, column.Name, table);
            var templateInfo = _objectSpace.CreateWCObject <ITemplateInfo>();

            templateInfo.Name         = persistentReferenceMemberInfo.CodeTemplateInfo.CodeTemplate.TemplateType.ToString();
            templateInfo.TemplateCode =
                _foreignKeyCalculator.GetRefTableForeignKey(foreignKey, column.Name).Columns.OfType <ForeignKeyColumn>().Single(keyColumn => keyColumn.ReferencedColumn == column.Name).Name;
            persistentReferenceMemberInfo.TemplateInfos.Add(templateInfo);
        }
Ejemplo n.º 4
0
        public void CreateExtraInfos(Column column, IPersistentMemberInfo persistentMemberInfo, ForeignKeyCalculator foreignKeyCalculator)
        {
            var persistentReferenceMemberInfo = (IPersistentReferenceMemberInfo)persistentMemberInfo;

            if (persistentMemberInfo.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPOneToOnePropertyMember)
            {
                CreateTemplateInfo(persistentReferenceMemberInfo, column, foreignKeyCalculator);
            }
            else if (!column.InPrimaryKey && persistentMemberInfo.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPReadWritePropertyMember)
            {
                CreateCollection(persistentReferenceMemberInfo, persistentReferenceMemberInfo.Owner);
            }
        }