예제 #1
0
                public ManyToOneBuilder <TRelatedEntity> ForeignKey(
                    [NotNull] Expression <Func <TEntity, object> > foreignKeyExpression)
                {
                    Check.NotNull(foreignKeyExpression, "foreignKeyExpression");

                    return(new ManyToOneBuilder <TRelatedEntity>(_builder.ForeignKey(foreignKeyExpression.GetPropertyAccessList())));
                }
예제 #2
0
                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)));
                }
예제 #3
0
                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)));
                }