private static void IsDataProviderValid(SeederConfiguration configuration)
 {
     if (configuration.DataProvider == null)
     {
         throw new MissingConfigurationException("DataProvider");
     }
 }
 private static void IsRepositoryValid(SeederConfiguration configuration)
 {
     if (configuration.DefaultRepository == null)
     {
         throw new MissingConfigurationException("Repository");
     }
 }
        public SeederConfiguration Build()
        {
            var entitySettings = _entitySettingBuilders.Values
                                 .Select(b => b.Build(
                                             _defaultRepository,
                                             _defaultIdGeneration,
                                             _defaultPrimaryKeyNames))
                                 .ToList();

            if (!string.IsNullOrEmpty(_emptyStringMarker))
            {
                if (!(_typeTransformations[typeof(string)] is StringTransformation))
                {
                    throw new ConfigurationException("EmptyString marker can not be set, because the string transformation logic is overriden from you.", null);
                }

                _typeTransformations[typeof(string)] = new StringTransformation(_emptyStringMarker);
            }

            var configuration = new SeederConfiguration
            {
                AfterSaveAction             = _afterSaveAction,
                BeforeSaveAction            = _beforeSaveAction,
                DataProvider                = _dataProvider,
                DefaultIdGeneration         = _defaultIdGeneration,
                DefaultPrimaryKeyNames      = _defaultPrimaryKeyNames,
                DefaultRepository           = _defaultRepository,
                EntitySettings              = entitySettings,
                IsClearBeforeSeedingEnabled = _isClearBeforeSeedingEnabled,
                TypeTransformations         = _typeTransformations
            };

            var configurationValidator = new SeederConfigurationValidator();

            configurationValidator.IsValid(configuration);

            return(configuration);
        }
 public void IsValid(SeederConfiguration configuration)
 {
     IsDataProviderValid(configuration);
     IsRepositoryValid(configuration);
 }