Beispiel #1
0
        /// <summary>
        ///     A helper method that creates the AssociationSetMapping and also tries to "Intelli-Match" some mappings, that is, if there are
        ///     columns and properties that match by name, we create mappings for the user.
        /// </summary>
        /// <param name="cpc"></param>
        /// <param name="association"></param>
        /// <param name="storageEntityType"></param>
        /// <returns></returns>
        internal static AssociationSetMapping CreateAssociationSetMappingAndIntellimatch(
            CommandProcessorContext cpc, Association association, StorageEntityType storageEntityType)
        {
            var associationSet = association.AssociationSet;

            Debug.Assert(associationSet != null, "An association found that doesn't have an association set");

            var cmd = new CreateAssociationSetMappingCommand(association, storageEntityType);

            CommandProcessor.InvokeSingleCommand(cpc, cmd);

            foreach (var setEnd in associationSet.AssociationSetEnds())
            {
                var builder = new AssociationSetEndMappingBuilderForCommand(setEnd, storageEntityType);
                builder.Build(cpc);
            }

            return(cmd.AssociationSetMapping);
        }
        /// <summary>
        ///     A helper method that creates the AssociationSetMapping and also tries to "Intelli-Match" some mappings, that is, if there are
        ///     columns and properties that match by name, we create mappings for the user.
        /// </summary>
        /// <param name="cpc"></param>
        /// <param name="association"></param>
        /// <param name="storageEntityType"></param>
        /// <returns></returns>
        internal static AssociationSetMapping CreateAssociationSetMappingAndIntellimatch(
            CommandProcessorContext cpc, Association association, StorageEntityType storageEntityType)
        {
            var associationSet = association.AssociationSet;
            Debug.Assert(associationSet != null, "An association found that doesn't have an association set");

            var cmd = new CreateAssociationSetMappingCommand(association, storageEntityType);
            CommandProcessor.InvokeSingleCommand(cpc, cmd);

            foreach (var setEnd in associationSet.AssociationSetEnds())
            {
                var builder = new AssociationSetEndMappingBuilderForCommand(setEnd, storageEntityType);
                builder.Build(cpc);
            }

            return cmd.AssociationSetMapping;
        }