public ManyToOneBuilder <TRelatedEntity> ForeignKey( [NotNull] Expression <Func <TEntity, object> > foreignKeyExpression) { Check.NotNull(foreignKeyExpression, "foreignKeyExpression"); return(new ManyToOneBuilder <TRelatedEntity>(_builder.ForeignKey(foreignKeyExpression.GetPropertyAccessList()))); }
public OneToOneBuilder <TDependentEntity> ForeignKey <TDependentEntity>( [NotNull] Expression <Func <TDependentEntity, object> > foreignKeyExpression) { Check.NotNull(foreignKeyExpression, "foreignKeyExpression"); var propertyAccessList = foreignKeyExpression.GetPropertyAccessList(); return(new OneToOneBuilder <TDependentEntity>( typeof(TDependentEntity) == typeof(TRelatedEntity) ? _builder.ForeignKey(propertyAccessList) : _builder.FlippedForeignKey(propertyAccessList))); }
public OneToOneBuilder <TDependentEntity> ForeignKey <TDependentEntity>( [CanBeNull] Expression <Func <TDependentEntity, object> > foreignKeyExpression = null) { if (foreignKeyExpression == null) { return(new OneToOneBuilder <TDependentEntity>( typeof(TDependentEntity) == typeof(TRelatedEntity) ? _builder : _builder.FlippedForeignKey(new PropertyInfo[0]))); } var propertyAccessList = foreignKeyExpression.GetPropertyAccessList(); return(new OneToOneBuilder <TDependentEntity>( typeof(TDependentEntity) == typeof(TRelatedEntity) ? _builder.ForeignKey(propertyAccessList) : _builder.FlippedForeignKey(propertyAccessList))); }