Exemplo n.º 1
0
        /// <summary>
        ///     Adds the submitted classes to the diagram.
        /// </summary>
        /// <param name="classes">A list of classes to add.</param>
        private void AddClasses(IEnumerable <NRClass> classes)
        {
            foreach (NRClass nrClass in classes)
            {
                ClassType classType = diagram.AddClass( );
                classType.Name           = nrClass.Name;
                classType.AccessModifier = nrClass.AccessModifier.ToNClass( );
                classType.Modifier       = nrClass.ClassModifier.ToNClass( );

                AddFields(classType, nrClass.Fields);
                AddProperties(classType, nrClass.Properties);
                AddEvents(classType, nrClass.Events);
                AddConstructors(classType, nrClass.Constructors);
                AddMethods(classType, nrClass.Methods);
                AddOperators(classType, nrClass.Operators);

                types.Add(nrClass, classType);
            }
        }
        private ClassType CreateClass(DatabaseTable table)
        {
            var name = textFormatter.FormatText(table.Name);

            ClassType classType = ClassAlreadyExists(name);

            if (classType != null)
            {
                return(classType);
            }

            classType = diagram.AddClass();
            classType.AccessModifier = AccessModifier.Public;
            classType.Modifier       = ClassModifier.None;
            classType.Name           = name;

            foreach (var column in table.Columns)
            {
                classType.AddProperty().InitFromString(CreateProperty(column, classType));
            }

            return(classType);
        }