예제 #1
0
 /// <summary>
 /// Removes a profile from the translator
 /// </summary>
 /// <param name="translationProfile">Profile to remove</param>
 public static void RemoveProfile(TranslationProfile translationProfile)
 {
     if (translationProfile == null)
     {
         return;
     }
     _store.RemoveProfile(translationProfile.ProfileName);
 }
        protected internal TranslationBase(Type type, TranslationProfile translationProfile, TranslationSettings translationSettings)
        {
            if (string.IsNullOrEmpty(translationSettings.TranslationName))
            {
                translationSettings.TranslationName = type.BuildFormattedName();
            }

            this.TranslationProfile = translationProfile;
            this.TranslationSettings = translationSettings;
            this.TraversedGenericArguments = type.GetTraversedGenericTypes().ToList();
            this.ColumnConfigurations = new List<NonIdentityColumnConfiguration>();
            this.TypeInfo = type.GetTypeInfo();
            this.TranslationUniqueIdentifier = TranslationUniqueIdentifier.GetInstance(this);
        }
예제 #3
0
        public void AddProfile(TranslationProfile translationProfile)
        {
            if (translationProfile == null)
            {
                throw new ArgumentNullException("translationProfile");
            }
            if (string.IsNullOrEmpty(translationProfile.ProfileName))
            {
                throw new TableTranslatorConfigurationException("Translation profile must have a name.");
            }
            if (GetProfile(translationProfile.ProfileName) != null)
            {
                throw new TableTranslatorConfigurationException(string.Format("This translation profile ({0}) already added.", translationProfile.ProfileName));
            }

            this._profiles.Add(translationProfile.ProfileName, translationProfile);
        }
예제 #4
0
 internal TableTranslatorConfigurationException(string message, TranslationProfile profile)
     : base(message)
 {
     this.TranslationProfile = profile;
 }
예제 #5
0
 /// <summary>
 /// Adds a profile to the translator
 /// </summary>
 /// <param name="translationProfile">Profile to add</param>
 public static void AddProfile(TranslationProfile translationProfile)
 {
     _store.AddProfile(translationProfile);
 }
        public void Null_profile_instance_passed_to_remove_profile_throws_ArgumentNullException()
        {
            TranslationProfile profile = null;

            Assert.DoesNotThrow(() => Translator.RemoveProfile(profile));
        }
 internal TableTranslatorConfigurationException(string message, TranslationProfile profile)
     : base(message)
 {
     this.TranslationProfile = profile;
 }