Skip to content

Commit ce71407

Browse files
2881028810
authored andcommitted
- 修复 EfFluentApi 一个参数类型问题;
1 parent 1e88e8a commit ce71407

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Extensions/FreeSql.Extensions.EfCoreFluentApi/EfCoreTableFluent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public HasManyFluent<T2> WithOne(Expression<Func<T2, T>> one)
271271
_tf.ConfigEntity<T2>(eb2 => eb2.Navigate(_withOneProperty, _selfBind));
272272
return this;
273273
}
274-
public HasManyFluent<T2> HasForeignKey(Expression<Func<T, object>> foreignKey)
274+
public HasManyFluent<T2> HasForeignKey(Expression<Func<T2, object>> foreignKey)
275275
{
276276
if (foreignKey?.Body == null) throw new ArgumentException("参数错误 foreignKey 不能为 null");
277277
var exp = foreignKey.Body;

Extensions/FreeSql.Extensions.EfCoreFluentApi/ICodeFirstExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ static void Test()
3636
//多对多
3737
eb.HasMany(a => a.Tags).WithMany(a => a.Songs, typeof(Song_tag));
3838
});
39+
cf.Entity<SongType>(eb =>
40+
{
41+
eb.HasMany(a => a.Songs).WithOne(a => a.Type).HasForeignKey( a => a.TypeId)
42+
});
3943
}
4044

4145
public class SongType

0 commit comments

Comments
 (0)