mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 修复 EfFluentApi 一个参数类型问题;
This commit is contained in:
@ -271,7 +271,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi
|
|||||||
_tf.ConfigEntity<T2>(eb2 => eb2.Navigate(_withOneProperty, _selfBind));
|
_tf.ConfigEntity<T2>(eb2 => eb2.Navigate(_withOneProperty, _selfBind));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public HasManyFluent<T2> HasForeignKey(Expression<Func<T, object>> foreignKey)
|
public HasManyFluent<T2> HasForeignKey(Expression<Func<T2, object>> foreignKey)
|
||||||
{
|
{
|
||||||
if (foreignKey?.Body == null) throw new ArgumentException("参数错误 foreignKey 不能为 null");
|
if (foreignKey?.Body == null) throw new ArgumentException("参数错误 foreignKey 不能为 null");
|
||||||
var exp = foreignKey.Body;
|
var exp = foreignKey.Body;
|
||||||
|
@ -36,6 +36,10 @@ namespace FreeSql.Extensions.EfCoreFluentApi
|
|||||||
//多对多
|
//多对多
|
||||||
eb.HasMany(a => a.Tags).WithMany(a => a.Songs, typeof(Song_tag));
|
eb.HasMany(a => a.Tags).WithMany(a => a.Songs, typeof(Song_tag));
|
||||||
});
|
});
|
||||||
|
cf.Entity<SongType>(eb =>
|
||||||
|
{
|
||||||
|
eb.HasMany(a => a.Songs).WithOne(a => a.Type).HasForeignKey( a => a.TypeId)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SongType
|
public class SongType
|
||||||
|
Reference in New Issue
Block a user