Esempio n. 1
0
        /// <summary>
        /// Configures this type to use stored procedures for insert, update and delete.
        /// </summary>
        /// <param name="modificationStoredProceduresConfigurationAction">
        /// Configuration to override the default conventions for procedure and parameter names.
        /// </param>
        /// <returns> The same configuration instance so that multiple calls can be chained. </returns>
        public ConventionTypeConfiguration MapToStoredProcedures(
            Action <ConventionModificationStoredProceduresConfiguration> modificationStoredProceduresConfigurationAction)
        {
            Check.NotNull <Action <ConventionModificationStoredProceduresConfiguration> >(modificationStoredProceduresConfigurationAction, nameof(modificationStoredProceduresConfigurationAction));
            this.ValidateConfiguration(ConventionTypeConfiguration.ConfigurationAspect.MapToStoredProcedures);
            ConventionModificationStoredProceduresConfiguration proceduresConfiguration = new ConventionModificationStoredProceduresConfiguration(this._type);

            modificationStoredProceduresConfigurationAction(proceduresConfiguration);
            this.MapToStoredProcedures(proceduresConfiguration.Configuration);
            return(this);
        }
        /// <summary>
        /// Configures this type to use stored procedures for insert, update and delete.
        /// </summary>
        /// <param name="modificationStoredProceduresConfigurationAction">
        /// Configuration to override the default conventions for procedure and parameter names.
        /// </param>
        /// <returns> The same configuration instance so that multiple calls can be chained. </returns>
        public ConventionTypeConfiguration MapToStoredProcedures(
            Action <ConventionModificationStoredProceduresConfiguration> modificationStoredProceduresConfigurationAction)
        {
            Check.NotNull(modificationStoredProceduresConfigurationAction, "modificationStoredProceduresConfigurationAction");
            ValidateConfiguration(ConfigurationAspect.MapToStoredProcedures);

            var modificationStoredProcedureMappingConfiguration = new ConventionModificationStoredProceduresConfiguration(_type);

            modificationStoredProceduresConfigurationAction(modificationStoredProcedureMappingConfiguration);

            MapToStoredProcedures(modificationStoredProcedureMappingConfiguration.Configuration);

            return(this);
        }
        public void MapToStoredProcedures_with_action_should_invoke_and_add_configuration()
        {
            var type        = new MockType();
            var innerConfig = new EntityTypeConfiguration(type);
            var config      = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration());

            ConventionModificationStoredProceduresConfiguration configuration = null;

            config.MapToStoredProcedures(c => configuration = c);

            Assert.Same(
                configuration.Configuration,
                innerConfig.ModificationStoredProceduresConfiguration);
        }
        /// <summary>
        /// Configures this type to use stored procedures for insert, update and delete.
        /// </summary>
        /// <param name="modificationStoredProceduresConfigurationAction">
        /// Configuration to override the default conventions for procedure and parameter names.
        /// </param>
        /// <returns> The same configuration instance so that multiple calls can be chained. </returns>
        public ConventionTypeConfiguration MapToStoredProcedures(
            Action<ConventionModificationStoredProceduresConfiguration> modificationStoredProceduresConfigurationAction)
        {
            Check.NotNull(modificationStoredProceduresConfigurationAction, "modificationStoredProceduresConfigurationAction");
            ValidateConfiguration(ConfigurationAspect.MapToStoredProcedures);

            var modificationStoredProcedureMappingConfiguration = new ConventionModificationStoredProceduresConfiguration(_type);

            modificationStoredProceduresConfigurationAction(modificationStoredProcedureMappingConfiguration);

            MapToStoredProcedures(modificationStoredProcedureMappingConfiguration.Configuration);

            return this;
        }