-
-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error No public methods with the specified arguments were found #1637
Comments
public interface I0
{
string NameI0 { get => "I0.Name"; }
string OverloadSuperMethod() => "I0.OverloadSuperMethod()";
string SubPropertySuperMethod() => "I0.SubPropertySuperMethod()";
}
public interface I1 : I0
{
string Name { get; }
string OverloadSuperMethod(int x) => $"I1.OverloadSuperMethod(int {x})";
new string SubPropertySuperMethod => "I1.SubPropertySuperMethod";
}
[Fact]
public void CallSuperPropertyFromInterface()
{
Assert.Equal(holder.I1.NameI0, _engine.Evaluate("holder.I1.NameI0"));
}
[Fact]
public void CallOverloadSuperMethod()
{
Assert.Equal(holder.I1.OverloadSuperMethod(1), _engine.Evaluate("holder.I1.OverloadSuperMethod(1)"));
Assert.Equal(holder.I1.OverloadSuperMethod(), _engine.Evaluate("holder.I1.OverloadSuperMethod()"));
}
[Fact]
public void CallSubPropertySuperMethod()
{
Assert.Equal(holder.I1.SubPropertySuperMethod, _engine.Evaluate("holder.I1.SubPropertySuperMethod"));
// Property and method cannot coexist
Assert.Throws<Exception>(() => _engine.Evaluate("holder.I1.SubPropertySuperMethod()"));
} You PR pass IMO, we'd better refactor TypeResolver , take care of the search order. |
How is the holder instantiated in your code?
Yes I agree, suggest refactoring |
I searched around in https://github.com/dotnetcore/FreeSql on GitHub (so not in an IDE) and I can't seem to find an implementation of |
@Genteure Here is a unit test in FreeSql In my project ,my method will retrun a type of public ISelect<object> SelectTypedQuery(string typeName = default)
{
if (string.IsNullOrEmpty(typeName))
{
return FreeSql.Select<object>().AsType(typeof(ContentItemIndex));
}
var indexService = _serviceProvider.GetRequiredService<IDynamicIndexAppService>();
var type = indexService.GetDynamicIndexType(typeName);
if (type != null)
{
return FreeSql.Select<object>().AsType(type);
}
else
{
throw new Exception($"Type not found. : {typeName} ");
}
} |
@hyzx86 我是想问它的实际运行时的类型是什么,方便我确认一下现在的 unit test 是否能代表实际你遇到的问题。我对那个项目不熟悉,项目里面的抽象层又太多,我在 GitHub 上搜索代码找不到一个实现了 objSelect.GetType().FullName |
@Genteure |
FreeSql.Sqlite.Curd.SqliteSelect`1[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] |
@Genteure 回复完 我愣了一下。。。我以为浏览器开了翻译。。原来你发的就是中文🤣 |
@Genteure 就在这个链接下,有个单元测试,返回的东西跟我的测试应该是一样的 select 的类型是: |
Version used
3.0.0-beta-2052
Describe the bug
Hi ,
I used Jint and FreeSql to encapsulate the changes of different databases and operate on the data. Recently, I encountered a problem.
Update from beta-2049 to beta-2052
An exception is thrown.
No public methods with the specified arguments were found.
See the last line for an example
ISelect SelectTypedQuery(string)
Where Method:
https://github.com/dotnetcore/FreeSql/blob/be6f2fa9c2cc04ce5bf01fc38d2b01a493021088/FreeSql/Interface/Curd/ISelect/ISelect0.cs#L291-L298
Any Method:
https://github.com/dotnetcore/FreeSql/blob/be6f2fa9c2cc04ce5bf01fc38d2b01a493021088/FreeSql/Interface/Curd/ISelect/ISelect0.cs#L195-L200
When I debug in jint, I find that I want to call
bool Any();
But always call to
bool Any(Expression<Func<T1, bool>> exp);
And it's the only one of the methods
https://github.com/dotnetcore/FreeSql/blob/be6f2fa9c2cc04ce5bf01fc38d2b01a493021088/FreeSql/Interface/Curd/ISelect/ISelect1.cs#L36C1-L41C50
The text was updated successfully, but these errors were encountered: