示例#1
0
        /// <summary>
        /// Updates the flattened MSL.
        /// </summary>
        /// <param name="mslDocument">The MSL document.</param>
        /// <param name="tableMappings">The table mappings.</param>
        /// <param name="discriminators">The discriminators.</param>
        /// <param name="storageSchemaName">Name of the storage schema.</param>
        internal void UpdateFlattenedMsl(XmlDocument mslDocument, TableMappingCollection tableMappings, Dictionary <Guid, int> discriminators, string storageSchemaName)
        {
            // Sort the resource types. We copy over mapping fragments from base type  to the
            // derived type and thus it is required that the base type is processed before
            // derived types.
            List <ResourceType> sortedTypes = DataModel.SortByHierarchy(this.ResourceTypes.ToList());

            // Process Resource Types.
            foreach (ResourceType resourceType in sortedTypes)
            {
                resourceType.UpdateFlattenedMsl(mslDocument, tableMappings, discriminators, storageSchemaName);
            }

            // Process Associations.
            foreach (Association association in this.Associations)
            {
                association.UpdateFlattenedMsl(mslDocument, tableMappings, storageSchemaName);
            }

            Association associationResourceHasFile = (from association in this.Parent.Modules[DataModellingResources.ZentityCore].Associations
                                                      where association.ObjectRole == typeof(File).Name
                                                      select association).FirstOrDefault();

            if (associationResourceHasFile != null)
            {
                foreach (ResourceType resourceType in this.ResourceTypes)
                {
                    associationResourceHasFile.UpdateFlattenedMslForFile(mslDocument, resourceType, storageSchemaName);
                }
            }
        }
示例#2
0
        internal void UpdateMsl(XmlDocument mslDocument, TableMappingCollection tableMappings, Dictionary <Guid, int> discriminators, string storageSchemaName)
        {
            // Sort the resource types. We copy over mapping fragments from base type  to the
            // derived type and thus it is required that the base type is processed before
            // derived types.
            List <ResourceType> sortedTypes = DataModel.SortByHierarchy(
                this.ResourceTypes.ToList());

            // Process Resource Types.
            foreach (ResourceType resourceType in sortedTypes)
            {
                resourceType.UpdateMsl(mslDocument, tableMappings, discriminators, storageSchemaName);
            }

            // Process Associations.
            foreach (Association association in this.Associations)
            {
                association.UpdateMsl(mslDocument, tableMappings, storageSchemaName);
            }
        }