Example #1
0
 public HasManyFluent HasMany(string many)
 {
     if (string.IsNullOrEmpty(many))
     {
         throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many"));
     }
     if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false)
     {
         throw new ArgumentException(DbContextStrings.ParameterError_NotFound_CollectionProperties(many));
     }
     if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false)
     {
         throw new ArgumentException(DbContextStrings.ParameterError_IsNot_CollectionProperties(many));
     }
     return(new HasManyFluent(_fsql, _tf, _entityType, manyProperty.PropertyType.GetGenericArguments()[0], manyProperty.Name));
 }
Example #2
0
 public void WithMany(string many, Type middleType)
 {
     if (string.IsNullOrEmpty(many))
     {
         throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many"));
     }
     if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false)
     {
         throw new ArgumentException(DbContextStrings.ParameterError_NotFound_CollectionProperties(many));
     }
     if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false)
     {
         throw new ArgumentException(DbContextStrings.ParameterError_IsNot_CollectionProperties(many));
     }
     _withManyProperty = manyProperty.Name;
     _tf.Navigate(_selfProperty, null, middleType);
     _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(_withManyProperty, null, middleType));
 }
Example #3
0
        public void ParameterError_IsNot_CollectionPropertiesTest()
        {
            string text = DbContextStrings.ParameterError_IsNot_CollectionProperties("1");

            output.WriteLine(text);
        }