示例#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));
 }
示例#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));
 }
示例#3
0
        public void ParameterError_NotFound_CollectionPropertiesTest()
        {
            string text = DbContextStrings.ParameterError_NotFound_CollectionProperties("1");

            output.WriteLine(text);
        }