Features connection, the Association, its generation and use example

According to base article metalowymi compositions are similar:

Composition

the Generation of SQL DDL

The structure definition DDL SQL is created like this:

  • The table corresponding to dealova class foreign key to the table corresponding cap;
  • Constraint linking table.

Generation .Net language

Described in detail in class Structure of the data objects.

Basic:

  1. In the class-detaile generated property assigned .Net attribute AgregatorAttribute private member, both of type class шапки;
  2. Storage metalowych sets of objects is generated by a special class that inherits from DetailArray;
  3. In the class header generated property and private member declared by a type spec.class - successor from DetailArray.

Additional editable properties

Properties composition (PTP link):

Description

Description metalowego properties.

Generation .Net language

Description (DocComment) the properties of array access metalowych objects class header

StartRole

The name of the role from the beginning of the track that duplicates the role name in the diagram

the Generation of SQL DDL

In the CREATE TABLE of the table of detail generates a field definition for the foreign key with the same name.

Generation .Net language

The name of the property-aggregator in the class-detaile.

StartMultiplicity

The multiplicity from the beginning of the Association, the duplicates on the chart. Can take any value, however, the generation can only be 1. If another value, the generation will stop with an error.

EndRole

The name of the role from the end of a song

Generation .Net language

The name of the property and private member class header

EndRoleStored

Generation .Net language

Private member class header is not generated and the code of the get and set accessors in a property remains empty (just brackets programmer every accessor)

Aggregator AutogenerateTypeUsage

Automatic generation of the types used for aggregator (header) in the class-detaile.

Automatic generation works as follows:

  1. Finds all successors of the aggregator (within stage);
  2. Classes were found, together with the aggregator, sorted by name on возрастанию;
  3. The result is the definition of used types.

the Generation of SQL DDL

In DDL table definition for class detail foreign keys are generated for each found class. The fields are named as follows:

<AggregatorStorage>_M<ПорядкНомерВTypeUsage>

ПорядкНомерВTypeUsage» «— starts at 0.

Generation .Net language

The property that specifies the aggregator, metalowego of the class .NET-attribute TypeUsageAttribute, showing all the found classes.

Aggregator A Typeusage

Used for aggregator (header) in the class-detaile.

Is ignored if the flag is Aggregator AutogenerateTypeUsage

You can specify the names of the used types (the names of the aggregator and any of his heirs, for which should be relevant to this dealova Association), separated by commas.

the Generation of SQL DDL

In DDL table definition for class detail generated foreign keys for each of the classes. The fields are named as follows:

<AggregatorStorage>_M<ПорядкНомерВTypeUsage>

ПорядкНомерВTypeUsage» «— starts at 0.

Generation .Net language

The property that specifies the aggregator, metalowego of the class .NET-TypeUsageAttribute attribute, indicating the specified classes.

AggregatorStorage

The name of the storage properties of the aggregator metalowego class.

the Generation of SQL DDL

If specified, this will be the field name of the foreign key in the table, respectively. class-detailw, not StartRole.

Generation .Net language

Before defining the properties, pointing to the aggregator in dealova class is generated by specifying attribute PropertyStorageAttribute (Namespace: ICSSoft.STORMNET, Assembly: ICSSoft.STORMNET.DataObject (in ICSSoft.STORMNET.DataObject.dll))

Detail AutogenerateTypeUsage

Automatic generation of the types used for detail class header.

Automatic generation works as follows:

  1. Finds all successors of detail (within stage);
  2. Classes were found, together with detaila are sorted by name by возрастанию;
  3. The result is the definition of used types.

Generation .Net language

Property pointing to an array metalowych objects class-hats, is prescribed .NET-TypeUsageAttribute attribute, indicating the specified classes.

Detail A Typeusage

Used for detail class header.

Generation .Net language

Property pointing to an array metalowych objects class-hats, is prescribed .NET-attribute TypeUsageAttribute, showing all the found classes.

PBAggregatorCustomAttributes

Generation .Net language

If the option specified is generated bracket programmer for manual application .Net attributes before the code properties of the aggregator in detaile.

PBAggregatorGetEnd

Generation .Net language

If the option specified is generated bracket programmer for manual entering of code before the end of the getter properties of the aggregator in detaile.

PBAggregatorGetStart

Generation .Net language

If the option specified is generated bracket programmer to “manual” any code after the beginning of getter properties of the aggregator in detaile.

PBAggregatorSetEnd

Generation .Net language

If the option specified is generated bracket programmer for manual entering of code before the end of the set accessors of properties of the aggregator in detaile.

PBAggregatorSetStart

Generation .Net language

If the option specified is generated bracket programmer for manual entering the code after the set accessor of the property-aggregator in detaile.

PBDetailCustomAttributes

Generation .Net language

If the option specified is generated bracket programmer for manual application .Net attributes before the code properties, indicate the array metalowych objects.

PBDetailGetEnd

Generation .Net language

If the option specified is generated bracket programmer for manual entering of code before the end of the getter of a property that identifies an array metalowych objects.

PBDetailGetStart

Generation .Net language

If the option specified is generated bracket programmer to “manual” any code after the beginning of getter properties that points to an array metalowych objects.

PBDetailSetEnd

Generation .Net language

If the option specified is generated bracket programmer for manual entering of code before the end of the set accessor of a property that identifies an array metalowych objects.

PBDetailSetStart

Generation .Net language

If the option specified is generated bracket programmer for manual entering the code after the set accessor of a property that identifies an array metalowych.

Example

For the above chart on the C# code looks as follows (for details, see structure of the classes of data objects:

The code for the class detail (class-detail - Step, the aggregator property with a private member of the Error class to hold an array of objects metalowych - DetailArrayOfШаг):

 public class Шаг : ICSSoft.STORMNET.DataObject
    {
        private int fНомер;
        private string fОписание;
        private ICSSoft.BugLeR.Ошибка fОшибка;       
        // *** Start programmer edit section *** (Step CustomMembers) 
        
        // *** End programmer edit section *** (Step CustomMembers) 
        
        // *** Start programmer edit section *** (Step.Room CustomAttributes) 

        // *** End programmer edit section *** (Step.Room CustomAttributes) 
        public virtual int Номер
        {
            get
            {
                // *** Start programmer edit section *** (Step.Room Get start) 

                // *** End programmer edit section *** (Step.Room Get start) 
                int result = this.fНомер;
                // *** Start programmer edit section *** (Step.Room Get end) 

                // *** End programmer edit section *** (Step.Room Get end) 
                return result;
            }
            set
            {
                // *** Start programmer edit section *** (Step.Set number start) 

                // *** End programmer edit section *** (Step.Set number start) 
                this.fНомер = value;
                // *** Start programmer edit section *** (Step.Room Set end) 

                // *** End programmer edit section *** (Step.Room Set end) 
            }
        }
        // *** Start programmer edit section *** (Step.Description CustomAttributes) 

        // *** End programmer edit section *** (Step.Description CustomAttributes) 
        public virtual string Описание
        {
            get
            {
                // *** Start programmer edit section *** (Step.Description Get start) 

                // *** End programmer edit section *** (Step.Description Get start) 
                string result = this.fОписание;
                // *** Start programmer edit section *** (Step.Description of Get end) 

                // *** End programmer edit section *** (Step.Description of Get end) 
                return result;
            }
            set
            {
                // *** Start programmer edit section *** (Step.Description Set start) 

                // *** End programmer edit section *** (Step.Description Set start) 
                this.fОписание = value;
                // *** Start programmer edit section *** (Step.Description Set end) 

                // *** End programmer edit section *** (Step.Description Set end) 
            }
        }
        
        /// <summary> 
        /// artisans link to the cap ICSSoft.BugLeR.Error 
        /// </summary> 
        // *** Start programmer edit section *** (Step.Error CustomAttributes) 

        // *** End programmer edit section *** (Step.Error CustomAttributes) 
        [Agregator())
        public virtual ICSSoft.BugLeR.Ошибка Ошибка
        {
            get
            {
                // *** Start programmer edit section *** (Step.Error Get start) 

                // *** End programmer edit section *** (Step.Error Get start) 
                ICSSoft.BugLeR.Ошибка result = this.fОшибка;
                // *** Start programmer edit section *** (Step.Error Get end) 

                // *** End programmer edit section *** (Step.Error Get end) 
                return result;
            }
            set
            {
                // *** Start programmer edit section *** (Step.Error Set start) 

                // *** End programmer edit section *** (Step.Error Set start) 
                this.fОшибка = value;
                // *** Start programmer edit section *** (Step.Error Set end) 

                // *** End programmer edit section *** (Step.Error Set end) 
            }
        }
    }
    
    /// <summary> 
    /// Array of Detail Step 
    /// </summary> 
    // *** Start programmer edit section *** (DetailArrayDetailArrayOfШаг CustomAttributes) 

    // *** End programmer edit section *** (DetailArrayDetailArrayOfШаг CustomAttributes) 
    public class DetailArrayOfШаг : ICSSoft.STORMNET.DetailArray
    {
        
        // *** Start programmer edit section *** (ICSSoft.BugLeR.DetailArrayOfШаг members) 
        
        // *** End programmer edit section *** (ICSSoft.BugLeR.DetailArrayOfШаг members) 
        
        /// <summary> 
        /// Construct array detail 
        /// </summary> 
        public DetailArrayOfШаг(ICSSoft.BugLeR.Ошибка fОшибка) : 
                base(typeof(Шаг), ((ICSSoft.STORMNET.DataObject)(fОшибка)))
        {
        }
        
        /// <summary> 
        /// Returns object with type Step by index 
        /// </summary> 
        public ICSSoft.BugLeR.Шаг this[int index)
        {
            get
            {
                return ((ICSSoft.BugLeR.Шаг)(this.ItemByIndex(index)));
            }
        }
        
        /// <summary> 
        /// Adds an object type with Step 
        /// </summary> 
        public virtual void Add(ICSSoft.BugLeR.Шаг dataobject)
        {
            this.AddObject(((ICSSoft.STORMNET.DataObject)(dataobject)));
        }
    }

Code for the class-caps (fragment class Error: private member and a property of type array metalowych objects DetailArrayOfШаг):

public class Ошибка : ICSSoft.STORMNET.DataObject
    {

        // ... 

        private ICSSoft.BugLeR.DetailArrayOfШаг fШагиДляВоспроизведения;

        // ... 

        // *** Start programmer edit section *** (Error.Saidsustainable CustomAttributes) 

        // *** End programmer edit section *** (Error.Saidsustainable CustomAttributes) 
        public virtual ICSSoft.BugLeR.DetailArrayOfШаг ШагиДляВоспроизведения
        {
            get
            {
                // *** Start programmer edit section *** (Error.Saidsustainable Get start) 

                // *** End programmer edit section *** (Error.Saidsustainable Get start) 
                if ((this.fШагиДляВоспроизведения == null))
                {
                    this.fШагиДляВоспроизведения = new ICSSoft.BugLeR.DetailArrayOfШаг(this);
                }
                ICSSoft.BugLeR.DetailArrayOfШаг result = this.fШагиДляВоспроизведения;
                // *** Start programmer edit section *** (Error.Saidsustainable Get end) 

                // *** End programmer edit section *** (Error.Saidsustainable Get end) 
                return result;
            }
            set
            {
                // *** Start programmer edit section *** (Error.Saidsustainable Set start) 

                // *** End programmer edit section *** (Error.Saidsustainable Set start) 
                this.fШагиДляВоспроизведения = value;
                // *** Start programmer edit section *** (Error.Saidsustainable Set end) 

                // *** End programmer edit section *** (Error.Saidsustainable Set end) 
            }
        }

        // ... 

    }