public HasOneFluent HasOne(string one) { if (string.IsNullOrEmpty(one)) { throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); } if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) { throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); } return(new HasOneFluent(_fsql, _tf, _entityType, oneProperty.PropertyType, one)); }
public HasOneFluent WithMany(string many) { if (many == null) { throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); } if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) { throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(many)); } _withManyProperty = manyProperty.Name; if (string.IsNullOrEmpty(_selfBind) == false) { _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(many, _selfBind)); } return(this); }
public HasManyFluent WithOne(string one) { if (string.IsNullOrEmpty(one)) { throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); } if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) { throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); } if (oneProperty.PropertyType != _entityType1) { throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); } _withOneProperty = oneProperty.Name; if (string.IsNullOrEmpty(_selfBind) == false) { _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(oneProperty.Name, _selfBind)); } return(this); }
public HasOneFluent WithOne(string one, string foreignKey) { if (string.IsNullOrEmpty(one)) { throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); } if (_entityType1.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) { throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); } if (oneProperty != _entityType1) { throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); } _withOneProperty = oneProperty.Name; if (foreignKey == null) { throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); } foreach (string name in foreignKey.Split(',')) { if (string.IsNullOrEmpty(name.Trim())) { continue; } _withOneBind += ", " + name.Trim(); } if (string.IsNullOrEmpty(_withOneBind)) { throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); } _withOneBind = _withOneBind.TrimStart(',', ' '); if (string.IsNullOrEmpty(_selfBind) == false) { _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(_withOneProperty, _withOneBind)); } return(this); }
public void ParameterError_NotFound_PropertyTest() { string text = DbContextStrings.ParameterError_NotFound_Property("1"); output.WriteLine(text); }